system-design

Part 12 — Case Studies

36 full system designs, each run through the framework from Part 11. This is where all the theory becomes muscle memory. Every case study follows the same structure — requirements, estimation, API, data model, high-level design, deep dives, bottlenecks, trade-offs, follow-ups, and what junior/mid/senior answers look like — so you learn the shape of a good answer, not just the facts of one system.

Time for this part: Weeks 3–8, in parallel with Part 11. Don’t read these passively — for each one, try to design it yourself first (set a 45-minute timer), then read. The gap between your answer and the write-up is your study list.

How to use them: The studies are ordered easy → hard and grouped by the pattern they teach. Patterns recur — fan-out, reserve-then-confirm, candidate-gen→rank, event-log-as-source-of-truth — and the studies cross-reference each other so you build a web, not a list. When a study reuses a pattern, it says so and moves on; learn to do the same in interviews.


The 36 designs

Warm-ups — the shape of an answer (Tier 1)

# Design Teaches
1 URL Shortener The template; read-heavy; cache; ID generation
2 Pastebin Metadata/blob split; object storage; CDN
3 Rate Limiter Algorithms; atomic ops; distributed counting
4 Key-Value Store Consistent hashing, quorums, conflict resolution (deep)
5 Web Crawler Frontier; Bloom filters; politeness; producer/consumer
6 Notification System Fan-out; queues; idempotency; flaky providers
7 Parking Lot (LLD) Object-oriented design; SOLID; extensibility

Social & media — fan-out and feeds (Tier 2)

# Design Teaches
8 Twitter / X Fan-out write vs read; the celebrity problem; hybrid
9 Instagram The media pipeline; async processing; CDN
10 News Feed Ranked feeds; candidate-gen → ranking
11 Chat System WebSockets; presence; delivery guarantees; offline sync
12 Video Streaming Transcoding; adaptive bitrate; CDN at planetary scale
13 File Storage / Dropbox Chunking; dedup; delta sync; conflict resolution

Location & marketplaces (Tier 2–3)

# Design Teaches
14 Ride-Hailing / Uber Geospatial indexing; matching; real-time location
15 Food Delivery Three-sided marketplace; sagas; predictive dispatch
16 Typeahead / Autocomplete Trie; precompute; batch+stream freshness

Infrastructure — build the building blocks (Tier 2–3)

# Design Teaches
17 Distributed Cache Consistent hashing; eviction; replication internals
18 Job Scheduler Exactly-once; leader election; lease-based recovery

Commerce, money & inventory — correctness first (Tier 3)

# Design Teaches
19 E-Commerce / Amazon Scoping a huge domain; inventory; strong-vs-eventual
20 Payment System Double-entry ledger; idempotency; reconciliation; CP
21 Ticketing / BookMyShow Seat reservation with expiry; on-sale spikes
22 Hotel Booking Availability over date ranges; overlap-free reservation

Search, maps & big data (Tier 3)

# Design Teaches
23 Google Search Inverted index; sharding; staged ranking
24 Google Maps Graph routing; precomputation; live traffic
25 Metrics System Time-series; cardinality; downsampling
26 Message Queue Commit log; offsets; delivery semantics
27 Log Aggregation Text search; hot/warm/cold tiering; correlation IDs
28 Ad Click Aggregator Stream processing; Lambda/Kappa; event-time windows

Real-time, correctness & ML (Tier 2–3)

# Design Teaches
29 Leaderboard Sorted sets; rank queries; exact-top / approx-tail
30 Collaborative Editing / Google Docs OT vs CRDT; convergence; real-time sync
31 Stock Exchange Matching engine; determinism; scale-up not out
32 Fraud Detection Real-time scoring; feature store; precision vs recall
33 Recommendation System Candidate-gen → ranking; embeddings; cold start

Platform & systems (Tier 2–3)

# Design Teaches
34 Feature Flag Service Local evaluation; config push; consistent rollouts
35 CI/CD Platform Job DAGs; isolation of untrusted code; autoscaling
36 Multiplayer Game Server Authoritative state; UDP; prediction; anti-cheat

The recurring patterns

Once you’ve done a dozen, you’ll notice the same handful of ideas solve most problems. This is the payoff — recognizing the pattern is half the battle:

  1. Read-heavy → cache + precompute. URL shortener, feeds, typeahead, search. Reads scale by copying.
  2. Fan-out (write vs read) + the celebrity/hot-key hybrid. Twitter, Instagram, news feed, notifications, chat groups.
  3. Metadata in the DB, big blobs in object storage + CDN. Pastebin, Instagram, video, file storage.
  4. Reserve-then-confirm with a TTL (don’t oversell). E-commerce, ticketing, hotel booking.
  5. Candidate generation → ranking (two-stage). News feed, recommendations, search, fraud.
  6. Precomputed feature store + fast online serving. Feed ranking, recommendations, fraud detection.
  7. Event log as source of truth; derive views; replay. Ad aggregator, stock exchange, payments, message queue.
  8. At-least-once + idempotency = exactly-once effect. Notifications, job scheduler, payments, queues.
  9. Strong consistency only for money & stock; eventual everywhere else. E-commerce, payments, ticketing.
  10. Geospatial index + partition by geography. Ride-hailing, food delivery, maps.
  11. Stateful real-time connections (WebSocket/UDP) + presence + reconnect sync. Chat, collaborative editing, multiplayer games.
  12. Batch (exact, slow) + stream (fresh, approximate) two-speed. Ad aggregator, typeahead, search, metrics, recommendations.

How to practice a case study

  1. Read the requirements only, then close the page.
  2. Design it yourself in 45 minutes — out loud, on a whiteboard, following the framework.
  3. Compare to the write-up. Note what you missed — a deep dive? the key trade-off? an edge case?
  4. Redo it a week later. The goal is fluency, not memorization — you should be able to derive the design, not recall it.
  5. Explain it to someone (or rubber-duck it). If you can teach it, you know it.

See Part 13 — Practice for structured drills and a problem bank.


Next: Part 13 — Practice — drills, self-grading, and how to turn these case studies into interview-ready fluency.