System Design
How real systems are put together — trade-offs, not just diagrams.
About System Design
System design is about the decisions behind software that serves many users: where data lives, how it is copied between machines, and what happens when part of the system fails. There is rarely one right answer, only trade-offs that fit a situation better or worse.
These guides cover the core theory — the CAP and PACELC theorems, replication, sharding, consensus and distributed transactions — and the practical problems that come with it, such as cache invalidation and the dual-write bug. Several guides then walk through full designs for real systems: an e-commerce platform, a social media feed, a payment system and an IoT telemetry pipeline.
They are written as reference material you can return to, and they work well as preparation for system design interviews.
Start here
- 1Why No Single Database Works
Why real systems combine several kinds of databases.
- 2CAP Theorem
The trade-off every distributed system has to make.
- 3Designing an E-Commerce Platform
A complete design that brings the core ideas together.
Why No Single Database Works
Why using one relational database for everything breaks down as an app grows — and how polyglot persistence fixes it.
CAP Theorem
During a network partition, a distributed system can guarantee at most two of Consistency, Availability, and Partition Tolerance.
PACELC Theorem
CAP only describes what happens during a partition — PACELC covers the trade-off a system faces the rest of the time.
Cache Invalidation Patterns
Cache-Aside, Write-Through, and Write-Behind — three different answers to who updates the cache, and when.
Replication Strategies
Leader-follower, multi-leader, and leaderless replication — three different answers to how copies of the same data stay in sync.
Sharding Strategies
Hash-based, range-based, and directory-based sharding — three ways to decide which shard a row actually lives on.
Distributed Transactions
Two-Phase Commit and the Saga pattern — two very different ways to keep a transaction consistent across multiple services or shards.
Consensus Algorithms
How Raft and Paxos let distributed nodes agree on a single value — like who's the leader — despite failures.
The Dual-Write Bug & CDC
Writing to a database and a cache as two separate steps looks fine — until the process crashes between them.
Designing a Financial/Payment System
A worked architecture where every choice this journey has covered gets picked for one reason: money cannot silently disappear or duplicate.
Designing a Social Media Feed
The opposite problem from a payment system: correctness matters less here than surviving a write volume that would crush a relational database.
Designing an E-Commerce Platform
One platform, two completely different consistency requirements: inventory can never lie, and search can lag by seconds without anyone noticing.
Designing an IoT Telemetry Pipeline
A hundred thousand sensors reporting once a second don't care whether your database is ready for them.
Choosing a Storage System
56 chapters of trade-offs, distilled into the four questions that actually decide which storage system belongs in your architecture.