All cheatsheets

Cheatsheets

Microservices

Patterns, communication, data, and resilience for microservice architectures — with a reference diagram.

Visualize

Raft — leader election & log replication (3D)

One elected leader serializes writes; a log entry commits once a majority of nodes replicate it.

Loading 3D…

27 entries

Decomposition & patterns8

API Gateway

Single entry point: routing, auth, rate limiting.

Backend for Frontend (BFF)

A gateway tailored per client (web/mobile)

Database per service

Each service owns its data; no shared DB.

Saga

Coordinate a multi-service transaction via events + compensation.

CQRS

Separate read and write models

Event sourcing

Persist state as a log of events

Strangler fig

Incrementally replace a monolith

Sidecar

Co-process for cross-cutting concerns (e.g. proxy)

Communication5

REST / gRPC

Synchronous request/response (gRPC = fast, typed)

Async messaging

Queues/topics decouple producers & consumers

Event-driven

React to domain events; loose coupling

Service mesh

Sidecars handle mTLS, retries, routing (Istio, Linkerd)

Service discovery

Find instances dynamically (DNS, Consul)

Data & consistency4

Eventual consistency

State converges over time, not instantly

Outbox pattern

Atomically persist state + the event to publish.

Idempotency keys

Make retried writes safe to repeat.

Distributed transaction

Avoid 2PC — prefer sagas + compensation

Resilience5

Circuit breaker

Stop calling a failing dependency so it can recover.

Retry + backoff

Retry transient failures with jitter

Bulkhead

Isolate resources so one failure won't sink all

Timeout

Bound every remote call

Rate limiting

Protect services from overload

Observability & delivery5

Distributed tracing

Follow a request across services (OpenTelemetry)

Correlation ID

Propagate a request id through all hops

Health checks

Liveness & readiness probes

Centralized logging

Aggregate structured logs (ELK, Loki)

Blue-green / canary

Release strategies that limit blast radius