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      │                      │
  │                    │  (HTTPS + JSON) │                      │
  │                    └────────┬────────┘                      │
  └─────────────────────────────│───────────────────────────────┘
                                │
          ┌─────────────────────┼──────────────────────┐
          │                     │                      │
   ┌──────▼──────┐    ┌────────▼────────┐   ┌────────▼────────┐
   │ 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 drives parallel gateway synchronization and correct multi-instance behavior. A run that cannot move on puts its instance in the INCIDENT state, which GET /api/v1/process-instances?filter.state=INCIDENT lists; an incident record is created only when a job is failed with no retries left.

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.

Layer 2 is part of the qubit-core library and is used embedded in Go code; it is not a hosted Priostack feature, and the REST API has no route that deploys Layer 2 configurations.

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. It needs no message broker, no separate database process and no service mesh, but it does run alongside the separate NGOR engine binary, and the Agent Context Network runs as its own service.

Hosted deployment: Priostack runs as a managed service; self-hosting is not offered. State is kept in JSON files in the server's working directory, written atomically (temp file, fsync, rename) on every change and reloaded at start, so in-flight instances survive a restart. There is no PostgreSQL or S3 backend, and no environment variable selects one; PostgreSQL persistence is on the roadmap. Completed instances and incidents are kept until the account is deleted.

Environment Variables

VariableDefaultDescription
PORT8080HTTP port the server listens on
ADMIN_KEY(none)Key the operator sends as X-Admin-Key on /api/admin/* routes
STRIPE_SECRET_KEY(optional)Enables Stripe billing integration
STRIPE_WEBHOOK_SECRET(optional)Verifies Stripe webhook signatures; without it Stripe webhooks are refused

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, /api/credits
       ├─► Zeebe Handler      POST /api/v1/process-*, /api/v1/jobs/*
       ├─► Operate Handler    GET /api/v1/process-instances, /api/v1/process-definitions
       ├─► Incidents Handler  /api/v1/incidents
       ├─► Tasklist Handler   /api/v1/graphql, /api/v1/tasks
       ├─► Billing Handler    /api/credits/buy, /api/wallet
       ├─► Static Files       pages, /docs/*
       └─► Admin Handler      /api/admin/*