System Design Reference
The modern stack, top to bottom - from the client all the way down to fiber. Open a layer to see its components, then open a component for a quick take.
Client
Anything originating a request - the source of traffic.
- Runs your web app. Pushes more logic to the edge of the network than it used to - caches, workers, WASM.
- Native iOS/Android or RN/Flutter. Offline-tolerant, push-driven, latency-sensitive.
- Scripts, internal tools, developer flows. Usually authenticated with a long-lived token or device flow.
- An LLM (or program) acting on a user's behalf - calls your APIs the same as a human would, just faster and weirder.
- Server-to-server. Typically mTLS or signed requests, no UI in the loop.
Edge
First thing your traffic actually touches.
- Maps names to addresses. Also a routing tool via weighted, geo, and latency records.
- Geo-distributed cache + TLS terminator. Often the first real performance win.
- Web application firewall - blocks common attacks before they reach your app.
- Absorbs volumetric attacks at the edge so the origin never sees them.
- Tiny compute at PoPs - auth, redirects, A/B, personalization without an origin hop.
- Decrypts at the edge so internal hops can be simpler - re-encrypt for zero-trust.
AI layer
Its own tier now - has infra of its own and reaches sideways into data.
- Single endpoint in front of many models. Handles routing, fallback, key management, logging.
- Picks model + system prompt per request based on intent, cost, latency.
- Retrieve from vector + structured stores, rerank, stuff context, call the model.
- ANN search on embeddings. Also lives in the data layer - same store, two consumers.
- Input/output filters - PII, jailbreaks, policy, schema validation on tool calls.
- Offline + online quality measurement. The thing that tells you a prompt change broke something.
API gateway
Contract layer between the outside world and your services.
- Validates tokens, exchanges sessions, injects identity downstream.
- Per-user, per-key, per-route. Protects the app and shapes pricing tiers.
- Rejects bad shapes before they hit your code. OpenAPI, gRPC, GraphQL schemas.
- Rewrites, header injection, response transforms, request collapsing.
- Path + method → upstream service. Often combined with canary and traffic splitting.
Application
Where product behavior lives - stateless so it can scale.
- Domain-bounded units of logic. Independently deployable, owned by a team.
- Per-client aggregation layer - trims and reshapes for web vs mobile vs agent.
- The actual rules of your product. Should be the boring, well-tested core.
- Lives here architecturally even if it's invoked from async - pulls jobs and runs them.
Async / messaging
Where most real systems actually live.
- Decouples producers and consumers. Retries, dead-letter, backpressure for free.
- Pub/sub fan-out - one event, many subscribers. Service Bus topics, SNS, NATS.
- Durable, replayable log. Kafka, Event Hubs, Kinesis, Redpanda.
- Consume from queues/streams. Slow, retryable, or off the request path.
- Cron-ish triggers - periodic jobs, scheduled emails, batch rollups.
Data
Owns durable state. Usually the hardest tier to scale.
- Transactional relational DB. Postgres, MySQL, SQL Server. Default until you have a reason.
- In-memory in front of slower systems. Redis, Memcached. Pick a consistency story.
- Inverted indexes for text + facets. Elasticsearch, OpenSearch, Meilisearch.
- Columnar, scans huge datasets. BigQuery, Snowflake, Synapse, ClickHouse.
- Cheap, durable blobs. S3, R2, ADLS/Blob. Backbone of data lakes and uploads.
- Embedding search. pgvector, Pinecone, Weaviate. Bridges into the AI layer.
Platform / runtime
What actually runs the app and data tiers.
- Scheduler, networking, rollout for containers. AKS, EKS, GKE.
- Functions, Container Apps, Cloud Run. Scales to zero, pays per request.
- The unit of deployment - image + runtime contract.
- Sidecar proxies for service-to-service TLS, retries, observability. Istio, Linkerd.
Network fabric
The plumbing every layer above rides on.
- Private network boundary in the cloud. Public, private, and database subnets is the usual split.
- Address space carved up by tier and AZ. Drives blast radius and routing.
- Allow/deny rules at the subnet or NIC level. Default-deny, document exceptions.
- Reach PaaS over the private network instead of the public internet.
- L4 routes by IP/port, L7 by URL/header/cookie. Pair with health checks.
- Private connection between VNets/VPCs - same region or across.
- Private link from on-prem into cloud. ExpressRoute is dedicated; VPN is over internet.
- Private name resolution inside the VNet. Often the source of mystery outages.
Compute
The actual machines under the platform.
- General-purpose virtual machines. Most workloads still land here under the abstraction.
- No hypervisor. Used when you need every cycle - HPC, large DBs, some AI training.
- Training and inference for ML, plus rendering. Increasingly the bottleneck and the budget.
- Hyper-V, KVM, Xen. Mostly invisible - but it sets the noisy-neighbor and live-migration story.
Physical
Real concrete and copper.
- Geographic area. Drives latency, data residency, and pricing.
- Independent datacenter(s) within a region. Failure domain for HA.
- The building. Power, cooling, security, connectivity.
- Servers + top-of-rack switch. A common failure unit.
- PSUs, UPS, generators, chillers. Capacity here caps everything above.
- Inter-DC and long-haul links. Cuts, congestion, and BGP issues live down here.
Identity & secrets
Who is calling, what can they do, how do we prove it.
- Identity provider - humans, services, managed identities.
- Delegated auth and federated login. Standard everywhere.
- Mutual TLS between services. Identity on the wire, not just in a token.
- Stores secrets, certs, keys. Rotate often, never check in.
- Workload identity issued by the platform - no secrets to manage.
Observability
If you can't see it, you can't fix it.
- Structured events. Cheap to write, expensive to query at scale.
- Numbers over time. Cheap, aggregatable, what your dashboards run on.
- Per-request span tree across services. The thing that actually explains latency.
- Continuous CPU/memory profiles. Finds the slow function, not just the slow service.
Security & policy
Applied at edge, gateway, app, and data - not a single layer.
- Pattern-based blocks at the edge. Tune to your traffic, not the defaults.
- Role-based access. The simple model that scales further than people expect.
- Org policy, naming, tagging, allowed regions. Enforced in IaC, not by hope.
- SOC2, ISO, HIPAA, PCI. Mostly evidence collection on top of good engineering.
Cost & capacity
Every layer has knobs that move the bill.
- Hard limits per subscription, region, SKU. Surprise here = outage.
- Scale on the right signal - CPU rarely is one. Often queue depth or p95.
- Tag, attribute, forecast, and right-size. Make cost a product metric.
Delivery
How code and config get to prod without taking it down.
- Build, test, scan, deploy. Fast feedback is the whole game.
- Terraform, Bicep, Pulumi. Infra in version control, reviewed like code.
- Canary, blue/green, feature flags. Limits blast radius of every change.
Each component will get a deeper page over time - diagrams, trade-offs, and worked examples.