Skip to content

Essential ​

Port: REST :3050 · gRPC :5050

Manages distributed saga transactions across multiple services. Sagas coordinate multi-step operations (e.g. a business creation that touches logistic/locations, financial/accounts, and context/configs atomically). Saga records and their per-step stages are stored in MongoDB.

Collections ​

CollectionPathPurpose
Sagas/essential/sagasTop-level orchestration record
Saga Stages/essential/saga-stagesPer-step execution history

essential/sagas ​

Tracks the top-level orchestration unit for a long-running or distributed operation.

Use the platform REST start endpoint — not the raw CRUD create:

POST /essential/sagas/start
{ "ttl": 3600 }

The Platform manages job, state, and session automatically. This is the correct path for user-facing saga orchestration.

Raw Create Fields (Advanced / Admin Use) ​

FieldRequiredTypeDescription
ttl✅numberSaga lifetime in seconds
job✅UUIDSaga job identifier — must be provided explicitly
state✅SagaStateAWAITING, ABORTED, COMMITTED
session✅hex stringAssociated session identity

Special Operations (Platform REST only — no MCP equivalent) ​

OperationHTTPPurpose
startPOST /essential/sagas/startInitiate a saga (preferred)
addPOST /essential/sagas/addAppend a stage to an in-flight saga
abortGET /essential/sagas/:id/abortAbort an in-flight saga
commitGET /essential/sagas/:id/commitCommit a completed saga

essential/saga-stages ​

Records one step within a saga, including what was attempted and what came back.

essential/saga-stages is callable via the MCP shared CRUD tools, as well as over platform REST.

Required Create Fields ​

FieldRequiredTypeDescription
saga✅MongoIdParent saga ID
bucket✅Collection enumTarget collection for this stage
action✅SagaStageActionCOUNT_DOCUMENTS, INSERT_MANY, FIND_ONE, FIND, FIND_ONE_AND_UPDATE, FIND_ONE_AND_DELETE, UPDATE_MANY
req✅objectCaptured request payload

Population ​

essential/saga-stages supports saga → EssentialSaga plus common population.

Key Behaviors ​

  • Sagas are typically backend-driven. Client code starts them with start, records work with add, and ends them with commit or abort.
  • If a saga's TTL expires before it is committed, the essential service's own SagasProcessor (BullMQ) triggers compensation (rollback) of all recorded stages.
  • The primary cross-service consumer is financial/transactions — every transaction is saga-linked.