Architecture Patterns - Complete Reference Map

// All 9 categories Β· Every major pattern Β· Layered top-to-bottom as a real system flows

56 total patterns
Client
Deployment
Security
Integration
Reliability
Distributed
Messaging
Data
Structural
UI/Frontend
00Internet / Client Zone- Who initiates requests into your system
↓
01Deployment & Infrastructure Patterns- How software is deployed, run, and released
↓
02Security Patterns- Verifying identity, controlling access, protecting data β˜… applies across ALL layers
↓
03Integration & Gateway Patterns- How clients connect to internal services
πŸšͺAPI Gatewayβ˜… entry point
Single entry point for ALL clients. Handles routing, auth, rate-limiting, caching, load balancing before touching any service.
Client β†’ [API Gateway] auth βœ“ β†’ route β†’ rate limit βœ“ β†’ cache βœ“ β†’ forward to correct service
e.g.: Kong, AWS API GW, Nginx, Express Gateway
πŸ“±BFF - Backend for Frontendintegration
Separate backend tailored for each client type. Mobile gets a lean API. Web gets a richer one.
Mobile β†’ BFF-Mobile β†’ services Web App β†’ BFF-Web β†’ services TV App β†’ BFF-TV β†’ services
e.g.: Netflix APIs, Next.js API routes, NestJS
πŸͺ—Aggregatorintegration
Calls multiple downstream services in parallel, merges all results into one single response for the client.
Client β†’ Aggregator β†’ [Svc A] + [Svc B] + [Svc C] ← merge β†’ single response
e.g.: GraphQL resolvers, Apollo Server, DataLoader
⚑Circuit Breakerresilience
Stops calls to failing downstreams to prevent cascade failures via CLOSED -> OPEN -> HALF-OPEN recovery probes.
CLOSED: requests flow normally 5 failures β†’ OPEN: block + fallback timeout β†’ HALF-OPEN β†’ test
e.g.: Hystrix, Resilience4j, Polly, opossum
πŸ”Retry / Fallbackresilience
Automatically retry transient failures. If retries exhaust, return cached/default fallback.
Attempt 1 ❌ β†’ wait 100ms Attempt 2 ❌ β†’ wait 200ms Attempt 3 βœ“ OR β†’ fallback
e.g.: axios-retry, p-retry, async-retry, Polly
πŸ”ŒAdapter / Anti-Corruption Layerintegration
Translates between incompatible interfaces or domain models. Keeps your domain clean from 3rd-party concepts.
Your Domain ← [ACL/Adapter] ← External translates models both ways your core stays clean
e.g.: SDK wrappers, zod mappers, legacy adapters
↓
04Reliability & Scalability Patterns- Keep the system up and handle load β˜… applies across ALL layers
🚒Bulkheadreliability
Isolate services into pools. One pool crashing doesn't sink the others.
Pool A: Search βœ“ Pool B: Orders βœ“ Pool C: Reports πŸ’₯ (isolated)
e.g.: Thread pools, K8s namespaces, Piscina
🚦Rate Limiting / Throttlingreliability
Control how many requests a client can make in a window. Protects from abuse and ensures fair usage.
100 req/min allowed 101st request β†’ 429 Too Many token-bucket / sliding window
e.g.: nginx rate limit, express-rate-limit, Bottleneck
πŸ“¦Cache-Asideperformance
App manages the cache manually. Check cache first, load DB on miss, then store in cache.
req β†’ check Redis HIT β†’ return cached ⚑ MISS β†’ load DB β†’ cache β†’ return
e.g.: Redis, Memcached, lru-cache, node-cache
✍️Write-Through / Write-Behindcaching
Write-Through writes cache and DB sync. Write-Behind writes cache first and DB later.
Write-Through: cache + DB sync Write-Behind: cache β†’ return DB write async later
e.g.: Redis write strategies, cache-manager, ioredis
πŸ“ŠRead Replicas / CQRS Scalingscale
Write to primary DB, read from replicas. Scale reads independently from writes.
Writes β†’ [Primary DB] ↓ replicate Reads β†’ [Replica 1][Replica 2]
e.g.: Postgres replicas, MySQL RDS, Prisma read replicas
πŸͺ“Shardingscale
Partition data horizontally across nodes by shard key. Each shard holds a slice of all data.
user_id 0–33% β†’ Shard A πŸ—„ user_id 34–66% β†’ Shard B πŸ—„ user_id 67–100%β†’ Shard C πŸ—„
e.g.: MongoDB sharding, Cassandra, Mongoose shard keys
↓
05Distributed Systems Patterns- How services are organized across machines
🧩Microservicesβ˜… core
Small, independently deployable services. Each owns its own data, process, and deployment cycle.
UserSvc → [DB: Postgres] OrderSvc → [DB: Mongo] PaymentSvc→ [DB: Redis] each independent!
e.g.: Netflix, Uber, NestJS, Fastify services
🏒SOA - Service Oriented Arch.distributed
Larger coarse-grained services communicating via an Enterprise Service Bus.
Service A ↕ ESB ↕ Service B Service C ↕ ESB ↕ Service D centralized bus
e.g.: IBM ESB, Oracle SOA Suite, Moleculer
πŸ•ΈοΈService Meshinfra
Infra layer for service-to-service communication. Handles retries, mTLS, tracing via sidecar proxies.
Svc A β†’ [Proxy] β†’ [Proxy] β†’ Svc B proxy handles: TLS, retry, observe, load balance
e.g.: Istio, Linkerd, Envoy, OpenTelemetry Node
πŸ›ΈSidecar Patterninfra
Deploy a helper container alongside the main service. Handles cross-cutting concerns.
Pod: [Main App] + [Sidecar] sidecar handles: logging, proxy, config, certs
e.g.: Envoy proxy, Fluent Bit, OpenTelemetry Collector
🀝Ambassadorproxy
A proxy helper that offloads network concerns from the main service.
App β†’ [Ambassador Proxy] β†’ Remote proxy handles: retry, auth, logging, throttle
e.g.: Ambassador API GW, Envoy, undici proxy agent
πŸ—„οΈDatabase per Servicedata isolation
Each microservice owns its private database. No service accesses another's DB directly.
Svc A β†’ own DB (Postgres) Svc B β†’ own DB (Mongo) Svc C β†’ own DB (Redis) complete isolation βœ“
e.g.: Microservices best practice, Prisma, TypeORM
↓
06Messaging & Communication Patterns- How services talk to each other asynchronously
↓
07Data Management Patterns- How data is stored, accessed, and kept consistent
βœ‚οΈCQRSβ˜… data
Command Query Responsibility Segregation. Separate write models from read models.
WRITE: Command β†’ Write DB ↓ sync/replicate READ: Query β†’ Read DB (denorm)
e.g.: Event-sourced systems, DDD, NestJS CQRS
🧬Polyglot Persistencedata
Use the right database technology for each specific need. Don't force one DB for everything.
Users β†’ PostgreSQL (relational) Sessions β†’ Redis (key-value) Products β†’ MongoDB (docs) Social β†’ Neo4j (graph)
e.g.: pg, ioredis, Mongoose, Neo4j driver
πŸ”€API Compositionquery
Query multiple services and join/aggregate results in a composer layer.
Client β†’ [Composer] β†’ [UserSvc] + [OrderSvc] ← merge β†’ combined response
e.g.: GraphQL schema stitching, Apollo Gateway
πŸ”’Two-Phase Commit (2PC)consistency
Atomic distributed transactions across multiple DBs. Prepare, then commit or rollback.
Phase 1 β€” Prepare: β†’ [DB1 βœ“] [DB2 βœ“] [DB3 βœ“] Phase 2 β€” Commit all or none
e.g.: XA transactions, DTC, node-postgres tx flows
πŸ”—Shared Database⚠️ coupling
Multiple services share one DB. Simple but creates tight coupling and brittle schema changes.
Svc A β†˜ Svc B β†’ [Shared DB πŸ’Ύ] Svc C β†— ⚠️ avoid in microservices!
e.g.: Monolith DB, legacy systems, Sequelize models
🏝️Database per Serviceisolation
Each service owns its own database schema and technology. No direct DB cross-access.
Svc A β†’ own DB (Postgres) Svc B β†’ own DB (Mongo) Svc C β†’ own DB (Redis) complete isolation βœ“
e.g.: Microservices gold standard, Prisma, Mongoose
↓
08AStructural / App Architecture
08BUI / Frontend Patterns
Security patterns (Zero Trust, OAuth, JWT) and Reliability patterns (Circuit Breaker, Bulkhead, Rate Limiting, Cache) are cross-cutting: they apply at every layer above, not just their designated row.