Microservices Saga Pattern

Free template — view it below, open it in draw.io, or customize it with AI in seconds.

Customize with AI — free Open in draw.io

The prompt behind this diagram

A microservices saga pattern architecture for order processing: order service, payment service, inventory service, shipping service, saga orchestrator, compensating transactions, Kafka event bus, outbox pattern with CDC.

Paste your own description (or Terraform / docker-compose / SQL schema) into draft1 and get a diagram like this for your exact system.

What this diagram shows

This diagram illustrates the Saga pattern for managing distributed transactions across microservices without a two-phase commit. A saga consists of a sequence of local transactions, each performed by a single service. When a step fails, compensating transactions are triggered in reverse order to undo completed work. The orchestrator coordinates the flow, an event bus carries state changes and compensation signals, and the outbox pattern ensures that events are written atomically with the service's local transaction, preventing event loss during failures.

Key components

When to use it

Use the Saga pattern when you need ACID-like guarantees across microservices without relying on distributed locks or two-phase commit. Suitable for long-running transactions (order processing, payment flows) where services are owned by different teams or deployed independently. Ideal when consistency must eventually settle rather than be instantaneous, and when rollback costs are acceptable. Avoid if your transaction set is tiny or if services must share transactional boundaries.

Common mistakes

Adapting it to your system

Identify your long-running business process and decompose it into steps, each owned by a single service. Define the local transaction and success event for each step. Then design a compensating transaction for each step that safely undoes its effects; document idempotency requirements so compensations can be retried. Implement the outbox pattern in each service: write the local data and an event row in one database transaction. Choose an event bus (Kafka, RabbitMQ, pub-sub) that your orchestrator can consume from reliably. Build the orchestrator as a state machine with persistent state storage so it can recover and resume after crashes. Test failure scenarios: inject faults at each step and verify compensation sequences execute correctly.

More templates

AWS VPC Multi-AZ Architecture

A production AWS VPC layout template: public/private/data subnets across two AZs with NAT, RDS multi-AZ and S3 endpoin

AWS EKS Cluster Architecture

An EKS reference template: control plane, node groups, ALB ingress, ECR, IAM roles for service accounts and storage.

AWS ECS Fargate Architecture

Serverless containers on AWS: ALB, Fargate services, SQS decoupling, RDS and Redis — a production ECS template.

Azure 3-Tier Web Architecture

The Azure counterpart of the classic 3-tier stack: Front Door, App Gateway, App Services, SQL and Redis in a VNet.

GCP Web Application Architecture

A serverless GCP stack template: Cloud Run, Cloud SQL, Memorystore, Pub/Sub and CDN-fronted load balancing.

Kafka Event Streaming Pipeline

End-to-end event streaming: CDC ingestion, a three-broker cluster, stream processing and analytical sinks.

Data Lakehouse Architecture

Bronze/silver/gold lakehouse template: ingestion, Delta Lake zones, Spark + dbt transforms and a BI serving layer.