Architecture
An event-driven choreography architecture diagram where microservices coordinate through events without a central orchestrator, with Order, Payment, Inventory, and Shipping services reacting to each other's domain events. This template models the decentralized coordination pattern where each service knows only its own responsibilities and publishes events for others to consume. Best for teams favoring autonomous services over centralized workflow control.
Full FlowZap Code
OrderService { # Order Service
n1: circle label:"New Order Received"
n2: rectangle label:"Validate Order"
n3: rectangle label:"Emit OrderCreated Event"
n17: rectangle label:"Receive Payment Confirmation"
n18: rectangle label:"Update Order Status"
n19: circle label:"Order Complete"
n1.handle(right) -> n2.handle(left)
n2.handle(right) -> n3.handle(left) [label="Valid"]
n3.handle(bottom) -> EventBus.n4.handle(top) [label="Publish"]
n17.handle(right) -> n18.handle(left) [label="Confirmed"]
n18.handle(right) -> n19.handle(left)
}
EventBus { # Event Bus
n4: rectangle label:"OrderCreated Topic"
n8: rectangle label:"PaymentConfirmed Topic"
n12: rectangle label:"InventoryReserved Topic"
n16: rectangle label:"ShipmentScheduled Topic"
n4.handle(bottom) -> PaymentService.n5.handle(top) [label="Subscribe"]
n8.handle(top) -> OrderService.n17.handle(bottom) [label="Notify"]
n8.handle(bottom) -> InventoryService.n9.handle(top) [label="Subscribe"]
n12.handle(bottom) -> ShippingService.n13.handle(top) [label="Subscribe"]
}
PaymentService { # Payment Service
n5: rectangle label:"Receive OrderCreated"
n6: rectangle label:"Process Payment"
n7: rectangle label:"Emit PaymentConfirmed"
n5.handle(right) -> n6.handle(left) [label="Charge"]
n6.handle(right) -> n7.handle(left) [label="Success"]
n7.handle(top) -> EventBus.n8.handle(bottom) [label="Publish"]
}
InventoryService { # Inventory Service
n9: rectangle label:"Receive PaymentConfirmed"
n10: rectangle label:"Reserve Stock"
n11: rectangle label:"Emit InventoryReserved"
n9.handle(right) -> n10.handle(left) [label="Allocate"]
n10.handle(right) -> n11.handle(left) [label="Reserved"]
n11.handle(top) -> EventBus.n12.handle(bottom) [label="Publish"]
}
ShippingService { # Shipping Service
n13: rectangle label:"Receive InventoryReserved"
n14: rectangle label:"Schedule Shipment"
n15: rectangle label:"Emit ShipmentScheduled"
n13.handle(right) -> n14.handle(left) [label="Plan Route"]
n14.handle(right) -> n15.handle(left) [label="Scheduled"]
n15.handle(top) -> EventBus.n16.handle(bottom) [label="Publish"]
}
Why This Workflow?
Centralized orchestrators become bottlenecks and single points of failure as the number of services grows. Event-driven choreography distributes coordination logic across services, where each service reacts autonomously to events—eliminating the need for a central coordinator and enabling truly independent service deployment.
How It Works
- Step 1: The Order Service creates a pending order and publishes an OrderCreated event.
- Step 2: The Payment Service subscribes to OrderCreated and processes the payment.
- Step 3: On success, a PaymentConfirmed event is published to the event bus.
- Step 4: The Inventory Service reacts to PaymentConfirmed by reserving stock.
- Step 5: The Shipping Service reacts to InventoryReserved by scheduling shipment.
- Step 6: The Order Service listens for saga completion events to update the final order status.
Alternatives
Orchestration-based sagas provide better visibility but create a central coordinator dependency. Choreography is harder to debug but more resilient. This template helps teams understand the event flow in a choreographed system.
Key Facts
| Template Name | Event-Driven Choreography Architecture |
| Category | Architecture |
| Steps | 6 workflow steps |
| Format | FlowZap Code (.fz file) |
Related templates
Architecture
A database-per-service architecture diagram where each microservice owns its dedicated data store, with event-driven synchronization via Kafka for cross-service data consistency. This template demonstrates the core microservices data isolation principle, showing how PostgreSQL and MongoDB coexist in a polyglot persistence strategy. Critical for architects enforcing service autonomy while maintaining eventual consistency.
Architecture
A saga choreography architecture diagram where Order, Payment, and Inventory services coordinate through domain events without a central orchestrator, with each service publishing and subscribing to events that drive the transaction forward or trigger compensation. This template models the decentralized saga approach where services autonomously react to events, reducing single points of failure at the cost of increased complexity in tracking saga state. Best for teams preferring service autonomy over centralized control.
Architecture
An event-driven agentic AI architecture that replaces the central orchestrator with Kafka/PubSub topics: agents subscribe, react, and publish new events. This aligns multi-agent systems with proven microservices choreography and is ideal for real-time, high-throughput systems and 'agent mesh' setups.
Architecture
A microservices API gateway architecture diagram showing request routing, JWT authentication, rate limiting, service discovery, and response aggregation across distributed backend services. This template models the entry point for all client traffic in a microservices ecosystem, enforcing security policies before requests reach internal services. Ideal for platform engineers designing scalable API infrastructure with centralized cross-cutting concerns.
Architecture
A Backend-for-Frontend architecture diagram with separate BFF layers for web and mobile clients, each optimizing API responses for their specific platform while sharing common backend microservices. This template shows how to avoid one-size-fits-all APIs by tailoring data aggregation and payload optimization per client type. Recommended for teams serving multiple frontend platforms from a shared microservices backend.
Architecture
An event-driven publish-subscribe architecture diagram with Kafka or RabbitMQ message broker, event serialization, topic partitioning, fan-out delivery to multiple consumers, and dead letter queue error handling. This template models the foundational async messaging pattern where producers and consumers are fully decoupled through a message broker. Essential for architects building loosely coupled, scalable event-driven systems.