Architecture

Priostack is built on a two-layer architecture that separates process execution from message routing. This design allows each layer to be optimized independently while remaining composable.

High-Level Overview


  ┌─────────────────────────────────────────────────────────────┐
  │                      PRIOSTACK                              │
  │                                                             │
  │  ┌──────────────────────────┐  ┌──────────────────────────┐│
  │  │      LAYER 1             │  │      LAYER 2             ││
  │  │  Execution Engine        │  │  EIP Routing Layer       ││
  │  │                          │  │                          ││
  │  │  • BPMN 2.0 Interpreter  │  │  • Message Channels      ││
  │  │  • DMN Decision Engine   │◄─►  • Message Router        ││
  │  │  • CMMN Case Engine      │  │  • Aggregator            ││
  │  │  • FEEL Evaluator        │  │  • Splitter              ││
  │  │  • Petri-Net Executor    │  │  • Correlation Context   ││
  │  │  • Token Manager         │  │  • Pipeline              ││
  │  └──────────────────────────┘  └──────────────────────────┘│
  │              │                              │               │
  │              └──────────────┬───────────────┘               │
  │                             │                               │
  │                    ┌────────▼────────┐                      │
  │                    │   REST API      │                      │
  │                    │  (Zeebe-compat) │                      │
  │                    └────────┬────────┘                      │
  └─────────────────────────────│───────────────────────────────┘
                                │
          ┌─────────────────────┼──────────────────────┐
          │                     │                      │
   ┌──────▼──────┐    ┌────────▼────────┐   ┌────────▼────────┐
   │ BPMN Modeler│    │  Job Workers    │   │  Admin Console  │
   │ (any tool)  │    │  (Go/Py/JS/...) │   │  (browser UI)   │
   └─────────────┘    └─────────────────┘   └─────────────────┘
    

Layer 1: Execution Engine

Layer 1 is the core process execution engine. It is responsible for interpreting BPMN, DMN, and CMMN models and managing the lifecycle of all process instances.

BPMN Interpreter

When a BPMN definition is deployed, the engine parses the XML and compiles it into an internal execution graph — a directed graph where each node is a BPMN element (task, gateway, event) and each edge is a sequence flow. The Petri-net executor then drives token movement through this graph.

DMN Decision Engine

Decision Requirements Graphs (DRGs) and decision tables are evaluated on-demand when a Business Rule Task or Call Activity references a DMN resource. The FEEL evaluator handles all expression evaluation within the decision table.

CMMN Case Engine

Case Plan Models are interpreted by the CMMN engine, which manages the lifecycle of stages, tasks, milestones, and sentries. The CMMN engine operates on an event-driven model: sentries listen for entry and exit criteria and trigger state transitions in the case plan.

Petri-Net Executor

Internally, Priostack maps BPMN constructs to a Petri-net representation for formal execution semantics. This enables deadlock detection (published as incidents), parallel gateway synchronization, and correct multi-instance behavior.

Layer 2: EIP Message Routing

Layer 2 implements Enterprise Integration Patterns on top of Layer 1. It provides message-oriented primitives for building complex integration scenarios without embedding routing logic in BPMN diagrams.

PatternDescription
Message ChannelTyped channel for routing messages between producers and consumers
Message RouterFEEL-based conditional routing to one or more channels
AggregatorCollect N messages matching a correlation key, emit combined result
SplitterFan-out a single message into N individual messages
Correlation ContextDeduplicate messages using event ID + time window
PipelineMulti-stage filter/transform chain applied to messages in order
Message TranslatorField mapping and transformation between message schemas
Message FilterPredicate-based message dropping (FEEL expression)
Message EndpointService task adapter linking Layer 2 messages to BPMN processes

See the Layer 2 Overview for detailed documentation on each pattern.

ArchiMate to BPMN Pipeline

Priostack supports an import pipeline from ArchiMate enterprise architecture models to BPMN process definitions. This allows architects to design at the business capability level and generate executable BPMN automatically.


  ArchiMate Model (.archimate) · Step 1: Parse ArchiMate XML
         | Extract: Business Processes, Application Services, Data Objects
         v
  Internal EA Graph · Step 2: Map EA concepts to BPMN elements
         |   Business Process  → Pool / Process
         |   Business Function → Lane
         |   Business Service  → Service Task
         |   Application Svc   → Service Task (automated)
         |   Data Object        → Variable definition
         |   Trigger Relation   → Sequence Flow
         v
  BPMN 2.0 XML (draft) · Step 3: Validate and enrich
         | Add: task definitions, gateway conditions, error boundaries
         v
  Deployable BPMN Definition
    

Deployment Model

Priostack ships as a single statically-linked binary. There are no external dependencies at runtime — no message broker, no separate database process, no service mesh required for the core engine.

Production Deployment: The binary can be deployed to any Linux host, Docker container, or Kubernetes pod. State is persisted to the local filesystem by default. For high-availability deployments, an external state store (S3-compatible or PostgreSQL) can be configured via environment variables.

Environment Variables

VariableDefaultDescription
PORT8080HTTP port the server listens on
ADMIN_KEY(auto-generated)API key for admin operations
STRIPE_SECRET_KEY(optional)Enables Stripe billing integration
STRIPE_WEBHOOK_SECRET(optional)Verifies Stripe webhook signatures
LOG_LEVELinfoLogging verbosity: debug, info, warn, error

Request Flow


  Client Request
       │
       ▼
  Security Headers Middleware
       │
       ▼
  IP Firewall (rate limiting, block list)
       │
       ▼
  Error Monitor Middleware
       │
       ▼
  Request ID Assignment
       │
       ▼
  Gzip Compression
       │
       ▼
  HTTP Mux (route matching)
       │
       ├─► Auth Handler       /api/signup, /api/me
       ├─► Zeebe Handler      /api/v1/process-*, /api/v1/jobs/*
       ├─► Operate Handler    /v1/process-instances, /v1/incidents
       ├─► Tasklist Handler   /graphql
       ├─► Billing Handler    /api/credits/buy
       ├─► Static Files       /docs/*, /static/*
       └─► Admin Handler      /api/admin/*