A modern backend, end to end.
This is a reference topology for the kind of system I design. Click any node to see its role and the trade-offs that come with it.
Click any node to see its role and the trade-offs that come with it. The dashed paths show event and request flow.
Request flow walkthrough
- 1Client sends request
- 2Traffic enters load balancer
- 3API Gateway routes request
- 4Microservices read/write cache and database
- 5Async work is pushed to message queue
- 6Workers consume and process jobs
- 7Response returns to client
Designing for failure
Every box on this diagram can fail. Circuit breakers at the gateway, idempotent consumers on Kafka, read replicas on Postgres, and replayable events mean no single failure cascades.
Separating writes from reads
Commands go through the API and commit to Postgres. Read models are projected asynchronously by workers into Postgres, Elasticsearch, and caches. Each store is tuned for its query shape.
Cost-aware scaling
Horizontal on stateless layers (API, workers), vertical and replicated on stateful ones (Postgres). Caches soak up the hot path. Object storage holds the long tail at tiny per-GB cost.