Event-driven orchestration project that couples a Node.js request engine with n8n workflow automation for secure routing, validation, and operational fallback handling.
This repository provides a production-oriented orchestration baseline where:
- inbound requests are validated and normalized in the backend
- events are emitted to n8n through a webhook contract
- n8n enforces key validation and controlled branching
- unsupported or unauthorized events are handled through explicit fallback paths
Core components:
- Node.js service layer for request lifecycle and provider broadcast
- n8n workflow for event routing and automation control
- optional PostgreSQL persistence for durable request and quote state
Primary flow:
- request is created in backend
- backend emits
request.createdto n8n webhook - n8n validates automation key
- n8n routes by service type across 5 branches
- n8n returns standardized webhook response
- key-gated webhook entry
- event gate (
request.created) - service routing branches:
- MEDICINE
- LAB
- DOCTOR
- PHYSIOTHERAPY
- RADIOLOGY
- unauthorized response path
- fallback response path for unsupported events or service values
src/backend services, routing logic, and integrationssql/database schema assetsn8n-workflows/workflow-related assets- hardened n8n workflow export JSON (single canonical file)
Install dependencies:
npm installRun backend:
npm startRun n8n in a separate terminal:
n8n startSet the automation webhook and shared key in local environment configuration.
Required automation variables:
N8N_WEBHOOK_URL=http://localhost:5678/webhook/<workflow-path>
N8N_API_KEY=<shared-secret>
N8N_TIMEOUT_MS=5000Ensure the same shared secret is used in backend and in the n8n workflow key-validation condition.
GET /healthPOST /webhook/<channel>GET /debug/requestsPOST /admin/complete/:requestId
- keep a single canonical workflow export and avoid parallel variants
- publish workflow updates with explicit version notes
- keep fallback path enabled for unsupported event or service payloads
- validate execution traces in n8n after each workflow revision
Additional operational context: