Saga pattern (distributed transactions) template

An orchestrated saga: local transactions across services, the compensating steps that undo them, and orchestration vs choreography.

Use this templateFree, opens in your browser. No sign-up.

Saga pattern (distributed transactions) template
Happy path: local transactions
Compensating transactions (run in reverse on failure)
Rules
Order saga orchestrator: state machine, persisted after every step
T1 Order service: create order (PENDING)
T2 Inventory: reserve stock
T3 Payment: charge card
T4 Shipping: book a courier
T5 Order service: mark APPROVED
C1 Cancel order (REJECTED)
C2 Release reserved stock
C3 Refund the charge
Aspect
Orchestration
Choreography
How steps run
A central orchestrator sends commands
Services react to each other's events
Coupling
Services know the orchestrator
Services know event names only
Visibility
Saga state in one place
Spread across services; needs tracing
Best for
4+ steps, complex rollback
2–3 simple steps
Compensations must be idempotent and retryable
Publish with the outbox pattern
After the pivot step (T4), only retry forward
Show PENDING states in the UI
Saga pattern: Place order
card declined
no courier
The saga pattern (distributed transactions) template as it opens in Kelvo: 9 boxes, 4 sticky notes, 1 table and 12 links, in 3 sections.

What's on the board

Happy path: local transactions
T1 Order service: create order (PENDING) · T2 Inventory: reserve stock · T3 Payment: charge card · T4 Shipping: book a courier · T5 Order service: mark APPROVED
Compensating transactions (run in reverse on failure)
C1 Cancel order (REJECTED) · C2 Release reserved stock · C3 Refund the charge
Rules
Compensations must be idempotent and retryable · Publish with the outbox pattern · After the pivot step (T4), only retry forward · Show PENDING states in the UI

Table columns: Aspect, Orchestration, Choreography.

Also on the board

  • Order saga orchestrator: state machine, persisted after every step

How to use this template

  1. Click Use this template. It opens in the Kelvo app as a new board, saved in your browser.
  2. Double-click any box to change its text. Replace the examples with your own content.
  3. Sketch, then convert. Draw boxes and arrows with the pen, select the strokes and click Convert sketch: they become real boxes and links.
  4. Ask Kelvo right on the board (Pro). With Pro, type @kelvo and what you want in any box or text, for example “@kelvo add error handling”, and press Enter. The change is made there and the request disappears; ⌘Z undoes it.
  5. One page per level. Put the C4 context view on one page and the container view on the next, so each diagram stays readable.

Good for

  • architect
  • saga
  • microservices
  • distributed transactions
  • patterns
  • Agreeing on boundaries and responsibilities between services
  • Recording why a design was chosen (and what was rejected)
  • Comparing integration options side by side

Related templates

  • Backend for frontend (BFF) template previewBackend for frontend (BFF)

    One backend per client experience: web, mobile and partner APIs that aggregate shared services, with what each BFF owns.

  • Microservices with API gateway template previewMicroservices with API gateway

    Clients behind an API gateway, services that each own their database, and an event bus for asynchronous work.

  • Integration patterns compared template previewIntegration patterns compared

    Request/response, queues, pub/sub and batch transfer side by side, with coupling, latency and when to use each.

  • Strangler fig migration template previewStrangler fig migration

    Replace a legacy monolith slice by slice behind a routing facade, in three phases, with a tracker for each slice.

  • LLM application architecture template previewLLM application architecture

    Production building blocks around a model: gateway, guardrails, orchestrator, cache, vector DB, tools and observability.

  • Service mesh overview (Istio) template previewService mesh overview (Istio)

    How a service mesh works: sidecar proxies beside every pod, mTLS between services, and a control plane pushing config and certs.

All solution architecture diagram templates · All templates

Use the saga pattern (distributed transactions) template