← All posts

Series

System Design Mastermind

Real products reverse-engineered for Senior system-design interviews. Start with Foundations (the core concepts, told as stories), then three tracks: the classics, platform and infrastructure, and AI/ML systems. Each one walks the flow, the numbers, the APIs, the databases and what happens when each piece fails, with every claim tagged as seen, inferred or unknown.

Start here: F01
Foundations
18/18
Classics
6/10
Platform & Infra
5/12
AI / ML systems
8/9
Published
37 · 12 coming

What Senior platform loops lean on.

19

Distributed job scheduler system design: on time, at least once, never lost

Jobs in a sharded store with a precomputed next_run_at → one scheduler per shard (lease + fencing token) claims due jobs every second: insert run (unique job_id + time) and advance next_run_at in one transaction → durable queue with deliver-at, enqueued a little early → workers lease runs, heartbeat, call the target with the run id as idempotency key → backoff, then a DLQ. At-least-once, made safe by idempotency.

32 min · interactive Preview
24

Metrics and logging system design (Datadog-style): series, roll-ups and alerts you can trust

Agents add up metrics for 10 s and batch them with logs → intake checks key and quotas, appends to a durable log, then 202 → writers map tags to series ids in an inverted index and store compressed points with roll-ups → logs: index a slice, archive all → monitors evaluate a window that ends in the past, and the whole stack is watched from outside.

32 min · interactive Preview
27

Kafka system design: a distributed log that never loses an acknowledged message

Topics split into partitions; the producer hashes the key, batches and sends to the partition leader → the leader appends to the page cache, followers in other zones pull, acks=all waits for every in-sync copy (RF 3, min ISR 2) → consumer groups pull from offsets and commit them → KRaft controllers move leaders; tiered storage keeps history.

33 min · interactive Preview
30

Ad click aggregator system design: exactly-once counts, late clicks and hot ads

Signed click URL → click service appends to Kafka and 302s → Flink dedupes by click id, counts per ad in 1-minute event-time windows, upserts (ad, minute) rows into an OLAP store → a per-click counter paces budgets → a nightly recount from raw clicks is what billing reads.

32 min · interactive Preview
33

Payment system design (Stripe): idempotency, unknown outcomes, the ledger and reconciliation

Card → vault → token; confirm with an Idempotency-Key → attempt row written before the bank call → gateway with timeouts and breakers → result + outbox in one commit → event log → append-only double-entry ledger and signed webhooks → a timeout is 'unknown', resolved by status check and the next day's settlement file → payouts from balances.

33 min · interactive Preview
··

Web crawler

Coming next
··

File sync (Dropbox)

Coming next
··

Google Docs: real-time collaboration

Coming next
··

Proximity service (Yelp)

Coming next
··

Leaderboard

Coming next
··

Unique ID generator

Coming next
··

Object storage (S3)

Coming next