Orchestrix is a self-hosted, distributed workflow automation engine built to ingest high-throughput webhook events, map dynamic variables across execution pipelines, and execute multi-step integration sequences.
The project is structured as an event-driven microservices architecture to decouple high-volume ingestion from asynchronous process execution.
Orchestrix is split into five decoupled services to guarantee system stability and horizontal scaling under load:
flowchart TD
Ingress[HTTP Webhook Client] -->|1. High-speed Ingest| Hooks[Hooks Service: Node/Express]
Hooks -->|2. Produce Message| Kafka[(Kafka Topic)]
subgraph Execution Cluster
Worker1[Worker 1]
Worker2[Worker 2]
WorkerN[Worker N]
end
Kafka -->|3. Consume Message| Worker1
Kafka -->|3. Consume Message| Worker2
Kafka -->|3. Consume Message| WorkerN
ExecutionCluster -->|4. Read/Write State| Postgres[(PostgreSQL db)]
ExecutionCluster -->|5. Resolve & Execute| Integrations[HTTP / AI / Email / Discord API]
Sweeper[Sweeper Service] -->|6. Monitor & Reap Orphans| Postgres
- Core Problem: Slow external integration endpoints (e.g., waiting for SMTP or LLM responses) should never block or bottleneck incoming webhook requests.
- Solution: The
hooksservice is a lean HTTP server focused solely on validating inbound requests, immediately publishing the payload to a Kafka topic, and returning a200 OK.
- Role: Serves as a distributed, partition-backed event log. It buffers incoming payloads, guarantees log durability, and enables concurrent consumer groups to process workflows out of order or sequentially as needed.
- Role: Horizontal scaling consumer cluster. Workers consume events from Kafka, compile variables, and handle network integrations.
- Variable Resolution Engine: Implements dynamic parsing of nested payloads. Variables stored as
{body.user.profile.email}or{step1.response.data.id}are resolved dynamically at runtime by evaluating the execution context tree.
- Backend: An Express API managing CRUD operations, authentications, and Zap blueprints.
- Prisma + PostgreSQL: Models relationships between Zaps, Triggers, Actions, and Runs. Designed with strict indexing on foreign keys (
zapId,userId) to optimize lookups in run histories.
- Core Problem: Distributed transactions are prone to network timeouts or worker crashes, leaving jobs stuck in an "IN_PROGRESS" state.
- Solution: A cron-like utility that polls the database for orphaned runs, analyzes execution time thresholds, and schedules retries or graceful failures to ensure system-wide consistency.
- Dynamic AST Variable Mapping: Resolves nested JSON payload paths at runtime to interpolate parameters between arbitrary workflow steps.
- Distributed Queue Isolation: Separates the API dashboard, webhook receiver, and worker executors to prevent high workflow volumes from affecting dashboard UI load times.
- Test Sandboxes: Allows developers to dry-run and mock HTTP configurations, AI prompts, and Discord payload runs before publishing.
- Premium Theme UI: Optimized Next.js dashboard featuring state visualization, layout builders, and dark-theme configurations.
The relations are modeled to handle sequential execution flows:
model Zap {
id String @id @default(uuid())
triggerId String
trigger Trigger?
actions Action[]
runs ZapRun[]
}
model Action {
id String @id @default(uuid())
zapId String
zap Zap @relation(fields: [zapId], references: [id])
type AvailableAction @relation(fields: [actionId], references: [id])
actionId String
sorting Int // Guarantees sequence order
}- Node.js (v18.x or above)
- PostgreSQL (v15.x or above)
- Apache Kafka (v3.x or above)
git clone https://github.com/your-username/Orchestrix.git
cd Orchestrixcd primary-backend
# Set environment variables in .env
npx prisma db push
npx tsx src/db/seed.tsRun the following in separate terminals to start the distributed system locally:
# Ingestion
cd hooks && npm run dev
# Worker Executor
cd worker && npm run dev
# Database API
cd primary-backend && npm run dev
# Frontend App
cd frontend && npm run dev