Skip to content

Architecture Deep Dive#

API server, scheduler, cron loop, and worker reaper all run in a single process. Core durable execution needs PostgreSQL in production or SQLite for local and single-node use. Optional integrations such as NATS, object storage, plugins, and external workers add their own dependencies.

orch8-serverREST API (Axum)Scheduler (100ms)Cron Loop (10s)HandlerRegistryWorker Task Reaper (30s)StorageBackend (Postgres impl)PostgreSQLNode / Python / GoWorkers

Crate structure

The engine is a Rust workspace with five crates:

  • orch8-typesShared domain types — IDs, instance states, block types, signals, context, config
  • orch8-engineCore execution logic — scheduler, evaluator, handlers, signals, templates, recovery, metrics
  • orch8-storageDatabase abstraction trait + PostgreSQL implementation
  • orch8-apiREST API layer — health, sequences, instances, metrics endpoints
  • orch8-serverApplication entry point — config loading, server startup, graceful shutdown

Snapshot-based execution

Orch8 persists execution state as work advances and resumes from the stored position rather than replaying user workflow code from the beginning. Recovery still includes normal database queries and scheduler work; it is not a latency guarantee.

AspectTemporalOrch8
Resume mechanismReplay entire historyRead last snapshot
Coding rulesNo Date.now(), no Math.random()Write normal code
State visibilityCustom query handlersREST API — GET /instances/{id}
Code changesRequire patched() markersApply immediately to new instances
Payload handlingHistory and payload limits applyDatabase and configured storage limits apply
TestingSDK test environmentsEngine validation and dry-run APIs

Two execution paths

Timer-driven (scheduling)

For campaign sequences where steps fire on a schedule. Every tick (default 100ms), the engine claims due instances using SELECT ... FOR UPDATE SKIP LOCKED, ordered by priority then fire time. For each instance it checks rate limits and either fires the handler or defers to the next available window.

Event-driven (orchestration)

For workflows with parallel steps, races, loops, and signals. When a step completes or a signal arrives, the engine evaluates the execution tree and immediately runs the next block — no timer delay.

Technology stack

LanguageRustPerformance, memory safety, no GC pauses
StoragePostgreSQL + SQLiteProduction on Postgres, zero-dep local dev on SQLite
APIREST + gRPC + SSEaxum-based REST; Tonic gRPC; SSE via /instances/{id}/stream
Plugin runtimeWasmtime (WASM)Sandboxed handler execution; wasm:// dispatch prefix
Message queueNATS (optional)async-nats subscriber; config-driven trigger subjects
File eventsnotify crateCross-platform fs-event trigger; recursive watch support
MetricsPrometheusCounters, histograms, gauges at /metrics
LoggingStructured JSONConfigurable level, tracing-based
DeploymentSingle binary + DockerMinimal ops

Storage abstraction

The engine uses a StorageBackend trait that abstracts all database operations. The PostgreSQL implementation is the production backend. The trait is designed so additional backends can be added.

Ready to try Orch8?

One command to install. Then run your first local sequence.

Bash
curl -fsSL https://orch8.io/start.sh | sh