distributed
Distributed Systems
What goes wrong when one system runs across many machines — and how they agree, stay available, and avoid making outages worse. Advanced; comfortable with one backend first.
Start track →Start from zero
Before the senior material: what a distributed system even is, and the handful of words the rest of the track assumes you already know.Cap practice
CAP in practice: consistency vs availability during inevitable partitions
Network partitions are inevitable. The only choice you get is to trade off consistency (correctness) against…
Raft consensus: leader election, log replication, and production operations
How three to seven machines agree on exactly one ordered log — leader election, AppendEntries, quorum commits, pre-vote, snapshots, and the ops discipline that keeps a Raft cluster alive in production.Quorum
Quorums: the R + W > N invariant and how it quietly breaks
A quorum is a tunable promise: if read replicas and write replicas overlap (R + W > N), a read sees the latest write.…
Leader election
Leader election: one writer, terms, and the split-brain that fencing tokens stop
A single leader serializes writes so a cluster avoids conflicts — but a GC pause or partition can leave two nodes both…
Clocks
Time and ordering: why wall-clock timestamps lie
Across a fleet, wall clocks drift and jump backward on NTP sync, so ordering writes by client timestamp silently drops…
Sagas
Sagas: long-lived transactions across services without 2PC
When a workflow spans flight, hotel, and car services, you cannot hold one ACID transaction across all of them. A saga…
Retry amplification
Retry amplification: how 3 retries per layer becomes a metastable outage
A naive retry on every layer of a deep call chain multiplies load geometrically — one request becomes 3^depth backend…
Putting it together
Putting it together: an order pipeline where the seams leak
Each distributed primitive — quorum, leader election, clocks, sagas, retries — is correct alone. The capstone is wiring…
Build with this track
Guided projects that exercise what you learn here.
At-least-once job queue
Build a durable job queue on Postgres with visibility timeouts and idempotent consumers, so a crashed worker never drops a job.
Circuit breaker
Build a circuit breaker that stops hammering a failing dependency, probes it safely with a half-open state, and resets automatically — the exact pattern that keeps microservice cascades from turning one bad node into a full outage.
Collaborative cursors
Show every connected user's live cursor and selection in a shared document, conflict-free, over WebSocket.
Consistent hashing ring
Build a virtual-node hash ring that remaps only the minimum set of keys when a node joins or leaves — the foundational primitive behind Dynamo, Cassandra, and every sharded cache that must survive node churn without a full reshuffle.
Job scheduler
A cron + backoff job runner with at-least-once delivery, idempotent handlers, and visibility timeouts — so no job is silently lost even when workers crash mid-execution.
Offline PWA sync
Offline-first notes PWA: a local write queue (IndexedDB) that syncs on reconnect with last-writer-wins conflict resolution, a service worker for asset caching, and background sync for missed flushes.
Distributed rate limiter
Build a token-bucket limiter that holds across many app instances by keeping the counter in Redis, not in process memory.
Union-Find (Disjoint Set Union)
Build a disjoint-set structure from a naive parent array up to near-constant amortized time — then use it to drive Kruskal's MST algorithm on a weighted graph.
Crash-safe key-value store with a WAL
Build a tiny on-disk KV store that survives a kill -9 mid-write by appending to a write-ahead log before touching the main file.
Security
The ways real apps get attacked and how to defend them — safe login and sessions, validating input, and the common mistakes that leak data.