Microservice Design Pattern List
✅1. Decomposition Patterns - How to break a monolith into microservices
By business capability
o Split by domain areas (e.g. billing, user management).
o Follows Domain-Driven Design (DDD).
By subdomain
o Aligns services to bounded contexts in DDD.
By transaction boundary
o Ensure services don't share transactions; design for eventual consistency.
✅ 2. Integration Patterns - How services talk to each other
API Gateway
o Single entry point, routing, authentication, rate limiting. E.g. Kong, AWS API
Gateway.
Backend for Frontend ( BFF)
o Tailored APIs for different clients (mobile/web).
o Solves one-size-fits-all problem.
Aggregator / Composite
o Combine multiple services' results into one response.
Proxy
o Simple pass-through to other services.
✅ 3. Communication Patterns - How services exchange data
Synchronous request/response
o REST, gRPC.
Asynchronous messaging
o Events, queues (RabbitMQ, Kafka).
Event-driven architecture
o Services publish/consume events.
✅ 4️. Data Management Patterns - Handling distributed data
Database per service
o Each service owns its schema.
o Avoid shared databases.
Shared database (anti-pattern)
o Can be okay short-term, but breaks autonomy.
Saga
o Distributed transaction management via events.
o Two types: choreography (event-based) or orchestration (central controller).
Command Query Responsibility Segregation (CQRS)
o Separate read and write models.
o Good for scaling reads.
Event Sourcing
o Store state changes as a sequence of events.
o Rebuild state from events.
✅ 5️. Reliability Patterns - Making services robust
Circuit Breaker
o Fail fast when dependency is down. E.g. Netflix Hystrix.
Retry
o Automatic retry on failure with backoff.
Timeout
o Don’t hang forever waiting for responses.
Bulkhead
o Isolate failures in parts of the system.
Fallback
o Provide default responses when dependencies fail.
✅ 6️. Transaction Patterns - Handling distributed workflows
Saga (again, for distributed transactions)
Process Manager / Orchestrator
o Coordinates complex workflows across services. E.g. Camunda, Temporal.
✅ 7️. Observability Patterns - Monitor and debug microservices
Log Aggregation
o Centralized logging (ELK stack, Loki).
Distributed Tracing
o Track request flow across services (Jaeger, Zipkin).
Metrics Collection
o Prometheus, Datadog.
Health Checks
o Expose readiness/liveness endpoints.
✅ 8️. Deployment Patterns - How to deploy services
Service Instance per Host
o One service per VM.
Service Instance per Container
o One service per Docker container.
o Kubernetes standard.
Serverless Deployment
o Functions as a Service (AWS Lambda).
Sidecar Pattern
o Deploy helper (e.g. proxy, logging) alongside main container.
o Service mesh (Envoy, Istio).
✅ 9️. Security Patterns - Secure microservices
API Gateway for centralized auth.
OAuth2 / OpenID Connect for user auth.
mTLS for service-to-service auth.
JWT for stateless auth.
Policy Enforcement Points for fine-grained access control.
✅ 10️Service Discovery Patterns - Finding service locations dynamically
Client-Side Discovery
o Client queries registry (Consul, Eureka).
Server-Side Discovery
o Load balancer queries registry.
DNS-Based Discovery
o Services resolved via DNS (Kubernetes).
✅ 11️. Infrastructure Patterns - Managing microservices at scale
Service Mesh
o Automatic discovery, security, retries, observability.
o Istio, Linkerd.
Centralized Configuration
o Store configs in Consul, Spring Cloud Config.
Infrastructure as Code
o Terraform, Pulumi.
✅ 12️. Anti-Patterns (what to avoid)
Distributed Monolith
o Too tightly coupled, despite being separate services.
Too Many Services Too Soon
o Complexity without need.
Shared Database
o Services stepping on each other's data.