System Design: Microservices Architecture
Master microservices design principles, service decomposition, discovery registries, circuit breakers, Saga distributed transactions, and structural patterns.
1. Monolith vs Microservices
Monolithic architectures package all business functions into a single deployment unit sharing one central database. While simple to develop initially, monolithic codebases become difficult to scale and deploy as engineering teams grow.
Microservices decompose an application into autonomous, independently deployable services centered around specific business capabilities. Each microservice manages its own dedicated database, preventing database-level coupling.
Monolithic Shared Architecture vs Microservices & Service Discovery
System DesignComparing single-codebase shared database models against decoupled services and dynamic registries
[
{
"id": "mono-box",
"type": "rectangle",
"x": 30,
"y": 40,
"width": 360,
"height": 280,
"strokeColor": "#ef4444",
"backgroundColor": "#fef2f2",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11000,
"version": 1,
"versionNonce": 11001,
"isDeleted": false
},
{
"id": "mono-box-text",
"type": "text",
"x": 60,
"y": 136,
"width": 300,
"height": 28,
"strokeColor": "#991b1b",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11002,
"version": 1,
"versionNonce": 11003,
"isDeleted": false,
"text": "Monolithic Architecture",
"fontSize": 14,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Monolithic Architecture",
"containerId": "mono-app"
},
{
"id": "mono-app",
"type": "rectangle",
"x": 50,
"y": 90,
"width": 320,
"height": 120,
"strokeColor": "#f87171",
"backgroundColor": "#fee2e2",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11004,
"version": 1,
"versionNonce": 11005,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "mono-box-text"
},
{
"type": "text",
"id": "mono-app-text"
}
]
},
{
"id": "mono-app-text",
"type": "text",
"x": 60,
"y": 129.375,
"width": 300,
"height": 41.25,
"strokeColor": "#991b1b",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11006,
"version": 1,
"versionNonce": 11007,
"isDeleted": false,
"text": "Single Codebase App Unit\n[Auth | Billing | Inventory | Orders]\nTightly Coupled Modules",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Single Codebase App Unit\n[Auth | Billing | Inventory | Orders]\nTightly Coupled Modules",
"containerId": "mono-app"
},
{
"id": "mono-arr",
"type": "arrow",
"x": 210,
"y": 210,
"width": 0,
"height": 40,
"strokeColor": "#ef4444",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
0,
40
]
],
"endArrowhead": "arrow",
"seed": 11008,
"version": 1,
"versionNonce": 11009,
"isDeleted": false
},
{
"id": "mono-db",
"type": "rectangle",
"x": 80,
"y": 250,
"width": 260,
"height": 50,
"strokeColor": "#dc2626",
"backgroundColor": "#fca5a5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11010,
"version": 1,
"versionNonce": 11011,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "mono-db-text"
}
]
},
{
"id": "mono-db-text",
"type": "text",
"x": 90,
"y": 261,
"width": 240,
"height": 28,
"strokeColor": "#7f1d1d",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11012,
"version": 1,
"versionNonce": 11013,
"isDeleted": false,
"text": "Shared Monolithic Database",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Shared Monolithic Database",
"containerId": "mono-db"
},
{
"id": "ms-box",
"type": "rectangle",
"x": 420,
"y": 40,
"width": 450,
"height": 280,
"strokeColor": "#10b981",
"backgroundColor": "#ecfdf5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11014,
"version": 1,
"versionNonce": 11015,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "ms-box-text"
}
]
},
{
"id": "ms-box-text",
"type": "text",
"x": 430,
"y": 166,
"width": 430,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11016,
"version": 1,
"versionNonce": 11017,
"isDeleted": false,
"text": "Microservices Architecture & Service Discovery",
"fontSize": 14,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Microservices Architecture & Service Discovery",
"containerId": "ms-box"
},
{
"id": "ms-registry",
"type": "rectangle",
"x": 560,
"y": 80,
"width": 180,
"height": 50,
"strokeColor": "#8b4dde",
"backgroundColor": "#f3e8ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11018,
"version": 1,
"versionNonce": 11019,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "ms-registry-text"
}
]
},
{
"id": "ms-registry-text",
"type": "text",
"x": 570,
"y": 91,
"width": 160,
"height": 28,
"strokeColor": "#6b21a8",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11020,
"version": 1,
"versionNonce": 11021,
"isDeleted": false,
"text": "Service Registry\n(Consul / Eureka)",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Service Registry\n(Consul / Eureka)",
"containerId": "ms-registry"
},
{
"id": "reg-a1",
"type": "arrow",
"x": 500,
"y": 190,
"width": 90,
"height": -60,
"strokeColor": "#8b4dde",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
90,
-60
]
],
"endArrowhead": "arrow",
"seed": 11022,
"version": 1,
"versionNonce": 11023,
"isDeleted": false
},
{
"id": "reg-a2",
"type": "arrow",
"x": 760,
"y": 190,
"width": -90,
"height": -60,
"strokeColor": "#8b4dde",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
-90,
-60
]
],
"endArrowhead": "arrow",
"seed": 11024,
"version": 1,
"versionNonce": 11025,
"isDeleted": false
},
{
"id": "ms-svc1",
"type": "rectangle",
"x": 440,
"y": 190,
"width": 140,
"height": 110,
"strokeColor": "#3b82f6",
"backgroundColor": "#dbeafe",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11026,
"version": 1,
"versionNonce": 11027,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "ms-svc1-text"
}
]
},
{
"id": "ms-svc1-text",
"type": "text",
"x": 450,
"y": 231,
"width": 120,
"height": 28,
"strokeColor": "#1e40af",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11028,
"version": 1,
"versionNonce": 11029,
"isDeleted": false,
"text": "Auth Service\n+ Own DB",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Auth Service\n+ Own DB",
"containerId": "ms-svc1"
},
{
"id": "ms-svc2",
"type": "rectangle",
"x": 595,
"y": 190,
"width": 140,
"height": 110,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11030,
"version": 1,
"versionNonce": 11031,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "ms-svc2-text"
}
]
},
{
"id": "ms-svc2-text",
"type": "text",
"x": 605,
"y": 231,
"width": 120,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11032,
"version": 1,
"versionNonce": 11033,
"isDeleted": false,
"text": "Orders Service\n+ Own DB",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Orders Service\n+ Own DB",
"containerId": "ms-svc2"
},
{
"id": "ms-svc3",
"type": "rectangle",
"x": 750,
"y": 190,
"width": 100,
"height": 110,
"strokeColor": "#f59e0b",
"backgroundColor": "#fef3c7",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11034,
"version": 1,
"versionNonce": 11035,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "ms-svc3-text"
}
]
},
{
"id": "ms-svc3-text",
"type": "text",
"x": 760,
"y": 231,
"width": 80,
"height": 28,
"strokeColor": "#b45309",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11036,
"version": 1,
"versionNonce": 11037,
"isDeleted": false,
"text": "Billing\n+ Own DB",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Billing\n+ Own DB",
"containerId": "ms-svc3"
}
]Monolithic Architecture
All features run inside a single process. Scaling requires replicating the entire application binary even if only one module is under load.
Microservices Architecture
Services are independently deployable, scaled according to specific workload demands, and built using heterogeneous tech stacks suitable for each domain.
2. Service Decomposition Strategies
Decomposing a system into microservices requires defining clear boundaries to avoid tight coupling and distributed monolith anti-patterns.
Decompose by Business Capability
Services are organized around high-level business functions (e.g. Order Management, Billing, Inventory, Customer Support).
Decompose by Subdomain (Domain-Driven Design)
Applies Domain-Driven Design (DDD) to identify Bounded Contexts. Core domains, supporting domains, and generic domains map to individual service boundaries.
3. Inter-Service Communication & Service Discovery
Microservices interact over network interfaces. Synchronous communication (REST, gRPC) provides direct request-response interactions, while asynchronous messaging (Kafka, RabbitMQ) decouples service lifecycles.
Service Discovery Registries (Consul, Eureka, Kubernetes DNS)
In dynamic container environments (Kubernetes), container IP addresses change frequently. Service discovery registries continuously track active container instances, allowing services to discover network endpoints automatically.
4. Resilience Patterns (Circuit Breaker, Bulkhead, Retry)
In distributed systems, remote service calls will fail. Resilience patterns prevent localized service failures from cascading across the entire cluster.
Circuit Breaker State Machine & Bulkhead Isolation
System DesignTracking CLOSED, OPEN, and HALF-OPEN transitions alongside thread pool bulkhead isolation
[
{
"id": "cb-box",
"type": "rectangle",
"x": 30,
"y": 40,
"width": 430,
"height": 280,
"strokeColor": "#2563eb",
"backgroundColor": "#eff6ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11038,
"version": 1,
"versionNonce": 11039,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "cb-box-text"
}
]
},
{
"id": "cb-box-text",
"type": "text",
"x": 40,
"y": 166,
"width": 410,
"height": 28,
"strokeColor": "#1e40af",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11040,
"version": 1,
"versionNonce": 11041,
"isDeleted": false,
"text": "Circuit Breaker State Machine",
"fontSize": 14,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Circuit Breaker State Machine",
"containerId": "cb-box"
},
{
"id": "cb-closed",
"type": "rectangle",
"x": 50,
"y": 90,
"width": 110,
"height": 60,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11042,
"version": 1,
"versionNonce": 11043,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "cb-closed-text"
}
]
},
{
"id": "cb-closed-text",
"type": "text",
"x": 60,
"y": 106,
"width": 90,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11044,
"version": 1,
"versionNonce": 11045,
"isDeleted": false,
"text": "CLOSED\n(Normal Operations)",
"fontSize": 10,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "CLOSED\n(Normal Operations)",
"containerId": "cb-closed"
},
{
"id": "cb-a1",
"type": "arrow",
"x": 160,
"y": 120,
"width": 50,
"height": 0,
"strokeColor": "#ef4444",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
50,
0
]
],
"endArrowhead": "arrow",
"seed": 11046,
"version": 1,
"versionNonce": 11047,
"isDeleted": false
},
{
"id": "cb-open",
"type": "rectangle",
"x": 210,
"y": 90,
"width": 110,
"height": 60,
"strokeColor": "#ef4444",
"backgroundColor": "#fee2e2",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11048,
"version": 1,
"versionNonce": 11049,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "cb-open-text"
}
]
},
{
"id": "cb-open-text",
"type": "text",
"x": 220,
"y": 106,
"width": 90,
"height": 28,
"strokeColor": "#991b1b",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11050,
"version": 1,
"versionNonce": 11051,
"isDeleted": false,
"text": "OPEN\n(Fails Fast instantly)",
"fontSize": 10,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "OPEN\n(Fails Fast instantly)",
"containerId": "cb-open"
},
{
"id": "cb-a2",
"type": "arrow",
"x": 265,
"y": 150,
"width": 0,
"height": 60,
"strokeColor": "#f59e0b",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
0,
60
]
],
"endArrowhead": "arrow",
"seed": 11052,
"version": 1,
"versionNonce": 11053,
"isDeleted": false
},
{
"id": "cb-half",
"type": "rectangle",
"x": 210,
"y": 210,
"width": 110,
"height": 60,
"strokeColor": "#f59e0b",
"backgroundColor": "#fef3c7",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11054,
"version": 1,
"versionNonce": 11055,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "cb-half-text"
}
]
},
{
"id": "cb-half-text",
"type": "text",
"x": 220,
"y": 226,
"width": 90,
"height": 28,
"strokeColor": "#b45309",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11056,
"version": 1,
"versionNonce": 11057,
"isDeleted": false,
"text": "HALF-OPEN\n(Test Probe Requests)",
"fontSize": 10,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "HALF-OPEN\n(Test Probe Requests)",
"containerId": "cb-half"
},
{
"id": "cb-a3",
"type": "arrow",
"x": 210,
"y": 240,
"width": -105,
"height": -90,
"strokeColor": "#10b981",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
-105,
-90
]
],
"endArrowhead": "arrow",
"seed": 11058,
"version": 1,
"versionNonce": 11059,
"isDeleted": false
},
{
"id": "bh-box",
"type": "rectangle",
"x": 480,
"y": 40,
"width": 390,
"height": 280,
"strokeColor": "#8b4dde",
"backgroundColor": "#f3e8ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11060,
"version": 1,
"versionNonce": 11061,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "bh-box-text"
}
]
},
{
"id": "bh-box-text",
"type": "text",
"x": 490,
"y": 166,
"width": 370,
"height": 28,
"strokeColor": "#6b21a8",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11062,
"version": 1,
"versionNonce": 11063,
"isDeleted": false,
"text": "Bulkhead Pattern (Resource Isolation)",
"fontSize": 14,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Bulkhead Pattern (Resource Isolation)",
"containerId": "bh-box"
},
{
"id": "bh-pool1",
"type": "rectangle",
"x": 500,
"y": 90,
"width": 350,
"height": 80,
"strokeColor": "#3b82f6",
"backgroundColor": "#dbeafe",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11064,
"version": 1,
"versionNonce": 11065,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "bh-pool1-text"
}
]
},
{
"id": "bh-pool1-text",
"type": "text",
"x": 510,
"y": 116,
"width": 330,
"height": 28,
"strokeColor": "#1e40af",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11066,
"version": 1,
"versionNonce": 11067,
"isDeleted": false,
"text": "Payment Service Thread Pool (Max 10 Threads)\nFailure here stays contained inside Payment pool",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Payment Service Thread Pool (Max 10 Threads)\nFailure here stays contained inside Payment pool",
"containerId": "bh-pool1"
},
{
"id": "bh-pool2",
"type": "rectangle",
"x": 500,
"y": 200,
"width": 350,
"height": 80,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11068,
"version": 1,
"versionNonce": 11069,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "bh-pool2-text"
}
]
},
{
"id": "bh-pool2-text",
"type": "text",
"x": 510,
"y": 226,
"width": 330,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11070,
"version": 1,
"versionNonce": 11071,
"isDeleted": false,
"text": "Inventory Service Thread Pool (Max 10 Threads)\nInventory requests run safely even if Payment fails",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Inventory Service Thread Pool (Max 10 Threads)\nInventory requests run safely even if Payment fails",
"containerId": "bh-pool2"
}
]Circuit Breaker Pattern
Wraps remote service calls in a monitor state machine. If errors exceed a threshold, the breaker trips OPEN, returning instant fallback responses to prevent cascading thread exhaustion.
Bulkhead Pattern
Isolates thread pools and memory quotas per downstream service dependency. A failure in the recommendation engine cannot exhaust thread pools dedicated to checkout operations.
Exponential Backoff with Jitter
Retries transient failures with exponentially increasing delays plus random noise (jitter) to prevent thundering herd retry storms.
Inspect the Node.js Circuit Breaker implementation below to see state machine transition logic in action.
Production Resilient Circuit Breaker Implementation
Managing CLOSED, OPEN, and HALF-OPEN state machine transitions with automated fallback handling
Press Run to execute the code and see output here.
5. Distributed Transactions (Saga Pattern)
Because each microservice owns its database, traditional two-phase commit (2PC) ACID transactions across services do not scale. The Saga pattern manages distributed transactions as a sequence of local transactions across services. If a step fails, the Saga executes compensating transactions in reverse order to undo changes.
Distributed Saga Pattern: Choreography vs Orchestration
System DesignComparing event-driven event bus coordination against central orchestrator state machines
[
{
"id": "saga-c-box",
"type": "rectangle",
"x": 30,
"y": 40,
"width": 400,
"height": 280,
"strokeColor": "#d97706",
"backgroundColor": "#fffbe6",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11072,
"version": 1,
"versionNonce": 11073,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "saga-c-box-text"
}
]
},
{
"id": "saga-c-box-text",
"type": "text",
"x": 40,
"y": 166,
"width": 380,
"height": 28,
"strokeColor": "#92400e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11074,
"version": 1,
"versionNonce": 11075,
"isDeleted": false,
"text": "Saga Choreography (Event-Driven)",
"fontSize": 14,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Saga Choreography (Event-Driven)",
"containerId": "saga-c-box"
},
{
"id": "sc-svc1",
"type": "rectangle",
"x": 50,
"y": 90,
"width": 100,
"height": 50,
"strokeColor": "#f59e0b",
"backgroundColor": "#fef3c7",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11076,
"version": 1,
"versionNonce": 11077,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "sc-svc1-text"
}
]
},
{
"id": "sc-svc1-text",
"type": "text",
"x": 60,
"y": 101,
"width": 80,
"height": 28,
"strokeColor": "#b45309",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11078,
"version": 1,
"versionNonce": 11079,
"isDeleted": false,
"text": "Order Svc",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Order Svc",
"containerId": "sc-svc1"
},
{
"id": "sc-a1",
"type": "arrow",
"x": 150,
"y": 115,
"width": 40,
"height": 0,
"strokeColor": "#d97706",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
40,
0
]
],
"endArrowhead": "arrow",
"seed": 11080,
"version": 1,
"versionNonce": 11081,
"isDeleted": false
},
{
"id": "sc-event",
"type": "rectangle",
"x": 190,
"y": 90,
"width": 100,
"height": 50,
"strokeColor": "#8b4dde",
"backgroundColor": "#f3e8ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11082,
"version": 1,
"versionNonce": 11083,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "sc-event-text"
}
]
},
{
"id": "sc-event-text",
"type": "text",
"x": 200,
"y": 101,
"width": 80,
"height": 28,
"strokeColor": "#6b21a8",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11084,
"version": 1,
"versionNonce": 11085,
"isDeleted": false,
"text": "Event Bus",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Event Bus",
"containerId": "sc-event"
},
{
"id": "sc-a2",
"type": "arrow",
"x": 290,
"y": 115,
"width": 30,
"height": 0,
"strokeColor": "#d97706",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
30,
0
]
],
"endArrowhead": "arrow",
"seed": 11086,
"version": 1,
"versionNonce": 11087,
"isDeleted": false
},
{
"id": "sc-svc2",
"type": "rectangle",
"x": 320,
"y": 90,
"width": 90,
"height": 50,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11088,
"version": 1,
"versionNonce": 11089,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "sc-svc2-text"
}
]
},
{
"id": "sc-svc2-text",
"type": "text",
"x": 330,
"y": 101,
"width": 70,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11090,
"version": 1,
"versionNonce": 11091,
"isDeleted": false,
"text": "Payment",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Payment",
"containerId": "sc-svc2"
},
{
"id": "sc-comp",
"type": "arrow",
"x": 320,
"y": 130,
"width": -220,
"height": 10,
"strokeColor": "#ef4444",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
-220,
10
]
],
"endArrowhead": "arrow",
"seed": 11092,
"version": 1,
"versionNonce": 11093,
"isDeleted": false
},
{
"id": "sc-comp-text",
"type": "rectangle",
"x": 50,
"y": 190,
"width": 360,
"height": 100,
"strokeColor": "#ef4444",
"backgroundColor": "#fef2f2",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11094,
"version": 1,
"versionNonce": 11095,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "sc-comp-text-text"
}
]
},
{
"id": "sc-comp-text-text",
"type": "text",
"x": 60,
"y": 226,
"width": 340,
"height": 28,
"strokeColor": "#991b1b",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11096,
"version": 1,
"versionNonce": 11097,
"isDeleted": false,
"text": "On Failure: Payment emits PaymentFailedEvent.\nOrder Svc receives event and triggers local compensating transaction.",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "On Failure: Payment emits PaymentFailedEvent.\nOrder Svc receives event and triggers local compensating transaction.",
"containerId": "sc-comp-text"
},
{
"id": "saga-o-box",
"type": "rectangle",
"x": 450,
"y": 40,
"width": 420,
"height": 280,
"strokeColor": "#2563eb",
"backgroundColor": "#eff6ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11098,
"version": 1,
"versionNonce": 11099,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "saga-o-box-text"
}
]
},
{
"id": "saga-o-box-text",
"type": "text",
"x": 460,
"y": 166,
"width": 400,
"height": 28,
"strokeColor": "#1e40af",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11100,
"version": 1,
"versionNonce": 11101,
"isDeleted": false,
"text": "Saga Orchestration (Central Coordinator)",
"fontSize": 14,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Saga Orchestration (Central Coordinator)",
"containerId": "saga-o-box"
},
{
"id": "so-orch",
"type": "rectangle",
"x": 590,
"y": 90,
"width": 150,
"height": 60,
"strokeColor": "#2563eb",
"backgroundColor": "#dbeafe",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11102,
"version": 1,
"versionNonce": 11103,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "so-orch-text"
}
]
},
{
"id": "so-orch-text",
"type": "text",
"x": 600,
"y": 106,
"width": 130,
"height": 28,
"strokeColor": "#1e40af",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11104,
"version": 1,
"versionNonce": 11105,
"isDeleted": false,
"text": "Saga Orchestrator\n(Master State Machine)",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Saga Orchestrator\n(Master State Machine)",
"containerId": "so-orch"
},
{
"id": "so-a1",
"type": "arrow",
"x": 610,
"y": 150,
"width": -80,
"height": 60,
"strokeColor": "#2563eb",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
-80,
60
]
],
"endArrowhead": "arrow",
"seed": 11106,
"version": 1,
"versionNonce": 11107,
"isDeleted": false
},
{
"id": "so-a2",
"type": "arrow",
"x": 660,
"y": 150,
"width": 0,
"height": 60,
"strokeColor": "#2563eb",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
0,
60
]
],
"endArrowhead": "arrow",
"seed": 11108,
"version": 1,
"versionNonce": 11109,
"isDeleted": false
},
{
"id": "so-a3",
"type": "arrow",
"x": 710,
"y": 150,
"width": 80,
"height": 60,
"strokeColor": "#2563eb",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
80,
60
]
],
"endArrowhead": "arrow",
"seed": 11110,
"version": 1,
"versionNonce": 11111,
"isDeleted": false
},
{
"id": "so-s1",
"type": "rectangle",
"x": 470,
"y": 210,
"width": 110,
"height": 60,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11112,
"version": 1,
"versionNonce": 11113,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "so-s1-text"
}
]
},
{
"id": "so-s1-text",
"type": "text",
"x": 480,
"y": 226,
"width": 90,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11114,
"version": 1,
"versionNonce": 11115,
"isDeleted": false,
"text": "Order Service",
"fontSize": 10,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Order Service",
"containerId": "so-s1"
},
{
"id": "so-s2",
"type": "rectangle",
"x": 605,
"y": 210,
"width": 110,
"height": 60,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11116,
"version": 1,
"versionNonce": 11117,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "so-s2-text"
}
]
},
{
"id": "so-s2-text",
"type": "text",
"x": 615,
"y": 226,
"width": 90,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11118,
"version": 1,
"versionNonce": 11119,
"isDeleted": false,
"text": "Payment Svc",
"fontSize": 10,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Payment Svc",
"containerId": "so-s2"
},
{
"id": "so-s3",
"type": "rectangle",
"x": 740,
"y": 210,
"width": 110,
"height": 60,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11120,
"version": 1,
"versionNonce": 11121,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "so-s3-text"
}
]
},
{
"id": "so-s3-text",
"type": "text",
"x": 750,
"y": 226,
"width": 90,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11122,
"version": 1,
"versionNonce": 11123,
"isDeleted": false,
"text": "Shipping Svc",
"fontSize": 10,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Shipping Svc",
"containerId": "so-s3"
}
]Saga Choreography
Services listen to domain events emitted by other services and execute local transactions independently without a central coordinator.
Saga Orchestration
A centralized Orchestrator service directs participating microservices on which local transactions to execute and triggers compensating rollbacks on failure.
Review the Saga Orchestrator engine below to see how compensating transactions execute on failure.
Saga Orchestrator Engine & Automated Rollback Handler
Coordinating distributed multi-service steps with automated compensating transaction execution
Press Run to execute the code and see output here.
6. Structural Patterns (Strangler Fig, Sidecar, BFF)
Advanced microservices structural patterns manage client integration, legacy migrations, and cross-cutting operational concerns.
Microservices Ecosystem: Strangler Fig Gateway, BFF & Sidecar Mesh
System DesignVisualizing client-tailored BFF gateways, legacy migration routing, and service mesh sidecar proxies
[
{
"id": "st-client1",
"type": "rectangle",
"x": 30,
"y": 60,
"width": 110,
"height": 50,
"strokeColor": "#3b82f6",
"backgroundColor": "#dbeafe",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11124,
"version": 1,
"versionNonce": 11125,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-client1-text"
}
]
},
{
"id": "st-client1-text",
"type": "text",
"x": 40,
"y": 71,
"width": 90,
"height": 28,
"strokeColor": "#1e40af",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11126,
"version": 1,
"versionNonce": 11127,
"isDeleted": false,
"text": "Mobile App",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Mobile App",
"containerId": "st-client1"
},
{
"id": "st-client2",
"type": "rectangle",
"x": 30,
"y": 180,
"width": 110,
"height": 50,
"strokeColor": "#3b82f6",
"backgroundColor": "#dbeafe",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11128,
"version": 1,
"versionNonce": 11129,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-client2-text"
}
]
},
{
"id": "st-client2-text",
"type": "text",
"x": 40,
"y": 191,
"width": 90,
"height": 28,
"strokeColor": "#1e40af",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11130,
"version": 1,
"versionNonce": 11131,
"isDeleted": false,
"text": "Web App",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Web App",
"containerId": "st-client2"
},
{
"id": "st-a1",
"type": "arrow",
"x": 140,
"y": 85,
"width": 50,
"height": 0,
"strokeColor": "#3b82f6",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
50,
0
]
],
"endArrowhead": "arrow",
"seed": 11132,
"version": 1,
"versionNonce": 11133,
"isDeleted": false
},
{
"id": "st-a2",
"type": "arrow",
"x": 140,
"y": 205,
"width": 50,
"height": 0,
"strokeColor": "#3b82f6",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
50,
0
]
],
"endArrowhead": "arrow",
"seed": 11134,
"version": 1,
"versionNonce": 11135,
"isDeleted": false
},
{
"id": "st-bff1",
"type": "rectangle",
"x": 190,
"y": 60,
"width": 130,
"height": 50,
"strokeColor": "#8b4dde",
"backgroundColor": "#f3e8ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11136,
"version": 1,
"versionNonce": 11137,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-bff1-text"
}
]
},
{
"id": "st-bff1-text",
"type": "text",
"x": 200,
"y": 71,
"width": 110,
"height": 28,
"strokeColor": "#6b21a8",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11138,
"version": 1,
"versionNonce": 11139,
"isDeleted": false,
"text": "Mobile BFF Gateway",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Mobile BFF Gateway",
"containerId": "st-bff1"
},
{
"id": "st-bff2",
"type": "rectangle",
"x": 190,
"y": 180,
"width": 130,
"height": 50,
"strokeColor": "#8b4dde",
"backgroundColor": "#f3e8ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11140,
"version": 1,
"versionNonce": 11141,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-bff2-text"
}
]
},
{
"id": "st-bff2-text",
"type": "text",
"x": 200,
"y": 191,
"width": 110,
"height": 28,
"strokeColor": "#6b21a8",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11142,
"version": 1,
"versionNonce": 11143,
"isDeleted": false,
"text": "Web BFF Gateway",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Web BFF Gateway",
"containerId": "st-bff2"
},
{
"id": "st-a3",
"type": "arrow",
"x": 320,
"y": 85,
"width": 50,
"height": 50,
"strokeColor": "#8b4dde",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
50,
50
]
],
"endArrowhead": "arrow",
"seed": 11144,
"version": 1,
"versionNonce": 11145,
"isDeleted": false
},
{
"id": "st-a4",
"type": "arrow",
"x": 320,
"y": 205,
"width": 50,
"height": -60,
"strokeColor": "#8b4dde",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
50,
-60
]
],
"endArrowhead": "arrow",
"seed": 11146,
"version": 1,
"versionNonce": 11147,
"isDeleted": false
},
{
"id": "st-proxy",
"type": "rectangle",
"x": 370,
"y": 100,
"width": 140,
"height": 80,
"strokeColor": "#f59e0b",
"backgroundColor": "#fef3c7",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11148,
"version": 1,
"versionNonce": 11149,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-proxy-text"
}
]
},
{
"id": "st-proxy-text",
"type": "text",
"x": 380,
"y": 126,
"width": 120,
"height": 28,
"strokeColor": "#b45309",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11150,
"version": 1,
"versionNonce": 11151,
"isDeleted": false,
"text": "Strangler Fig Router\n(Legacy Interceptor)",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Strangler Fig Router\n(Legacy Interceptor)",
"containerId": "st-proxy"
},
{
"id": "st-a5",
"type": "arrow",
"x": 510,
"y": 120,
"width": 60,
"height": -40,
"strokeColor": "#ef4444",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
60,
-40
]
],
"endArrowhead": "arrow",
"seed": 11152,
"version": 1,
"versionNonce": 11153,
"isDeleted": false
},
{
"id": "st-a6",
"type": "arrow",
"x": 510,
"y": 160,
"width": 60,
"height": 40,
"strokeColor": "#10b981",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"points": [
[
0,
0
],
[
60,
40
]
],
"endArrowhead": "arrow",
"seed": 11154,
"version": 1,
"versionNonce": 11155,
"isDeleted": false
},
{
"id": "st-legacy",
"type": "rectangle",
"x": 570,
"y": 40,
"width": 280,
"height": 60,
"strokeColor": "#ef4444",
"backgroundColor": "#fef2f2",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11156,
"version": 1,
"versionNonce": 11157,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-legacy-text"
}
]
},
{
"id": "st-legacy-text",
"type": "text",
"x": 580,
"y": 56,
"width": 260,
"height": 28,
"strokeColor": "#991b1b",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11158,
"version": 1,
"versionNonce": 11159,
"isDeleted": false,
"text": "Legacy Monolith (Un-migrated Routes)",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Legacy Monolith (Un-migrated Routes)",
"containerId": "st-legacy"
},
{
"id": "st-pod",
"type": "rectangle",
"x": 570,
"y": 140,
"width": 280,
"height": 160,
"strokeColor": "#10b981",
"backgroundColor": "#ecfdf5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11160,
"version": 1,
"versionNonce": 11161,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-pod-text"
}
]
},
{
"id": "st-pod-text",
"type": "text",
"x": 580,
"y": 206,
"width": 260,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11162,
"version": 1,
"versionNonce": 11163,
"isDeleted": false,
"text": "New Microservice Pod Container",
"fontSize": 12,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "New Microservice Pod Container",
"containerId": "st-pod"
},
{
"id": "st-app",
"type": "rectangle",
"x": 590,
"y": 180,
"width": 110,
"height": 100,
"strokeColor": "#10b981",
"backgroundColor": "#d1fae5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11164,
"version": 1,
"versionNonce": 11165,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-app-text"
}
]
},
{
"id": "st-app-text",
"type": "text",
"x": 600,
"y": 216,
"width": 90,
"height": 28,
"strokeColor": "#047857",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11166,
"version": 1,
"versionNonce": 11167,
"isDeleted": false,
"text": "App Code\nNode.js",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "App Code\nNode.js",
"containerId": "st-app"
},
{
"id": "st-sidecar",
"type": "rectangle",
"x": 720,
"y": 180,
"width": 110,
"height": 100,
"strokeColor": "#8b4dde",
"backgroundColor": "#f3e8ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"roundness": {
"type": 3
},
"seed": 11168,
"version": 1,
"versionNonce": 11169,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "st-sidecar-text"
}
]
},
{
"id": "st-sidecar-text",
"type": "text",
"x": 730,
"y": 216,
"width": 90,
"height": 28,
"strokeColor": "#6b21a8",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"seed": 11170,
"version": 1,
"versionNonce": 11171,
"isDeleted": false,
"text": "Sidecar Proxy\n(Envoy mTLS)",
"fontSize": 11,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"originalText": "Sidecar Proxy\n(Envoy mTLS)",
"containerId": "st-sidecar"
}
]Strangler Fig Pattern
Incrementally replaces monolithic features by placing an interceptor router in front of the legacy monolith, steering endpoints to new microservices one by one.
Sidecar Pattern
Deploys operational helper components (logging, mTLS encryption, rate limiting) in a separate container running alongside the application container in the same pod (Service Mesh / Envoy).
Backend for Frontend (BFF)
Creates separate API gateways tailored specifically for different client types (e.g., Mobile BFF vs Web BFF), optimizing payload formats for each device type.
Microservices Architecture Knowledge Verification
1. What defines a microservices architecture?
2. What is the primary role of a Service Registry?
3. How does the Circuit Breaker pattern prevent cascading failures?
4. What is the main characteristic of the Saga Orchestration pattern?
5. What is the purpose of the Strangler Fig pattern?