What This Guide Covers
50 system design patterns organized into 10 categories
Real-world examples for every pattern so you can connect the concept to systems you already use
A cheat sheet you can review in 90 minutes before any system design interview
There are not 500 system design concepts.
There are roughly 50 patterns that recombine in different ways to solve every problem you will encounter in an interview or in production.
The engineer who knows these 50 patterns can design any system.
The engineer who has memorized the architectures of Twitter, Uber, and Netflix but does not know the underlying patterns will freeze the moment the interviewer asks a variation on them.
This guide gives you all 50.
Each pattern is explained concisely: what it does, when you reach for it, and what you trade away by using it.
The patterns are organized into 10 categories.
Read through the entire guide once (about 90 minutes), and you will have a working vocabulary for any system design conversation. Return to specific patterns when you need a refresher before an interview.
I've since expanded all 50 patterns into a full course, System Design Patterns: From Fundamentals to Real Systems: each pattern taught through a real production incident, with trade-offs, when NOT to use it, and a 30-second interview answer.
Reference
Category 1: Data Storage Patterns
1. Primary-Replica (Leader-Follower)
One database server (the primary) handles all writes.
One or more replicas receive copies of the writes and handle reads.
If the primary fails, a replica is promoted to become the new primary.
When to use: Any system where reads vastly outnumber writes (social media feeds, product catalogs, user profiles). You scale reads horizontally by adding more replicas.
Trade-off: Replicas may be slightly behind the primary (replication lag), so reads from replicas may return stale data. Use synchronous replication for zero lag (slower writes) or asynchronous replication for fast writes (risk of stale reads).
2. Sharding (Horizontal Partitioning)
Split your data across multiple database servers. Each server (shard) holds a portion of the data.
A shard key determines which shard holds which data.
When to use: When a single database cannot handle the write throughput or storage volume. A user table with 1 billion rows that receives 100,000 writes per second needs sharding.
Trade-off: Cross-shard queries are expensive (queries that need data from multiple shards require scatter-gather).
Choosing the wrong shard key creates hot spots. Resharding (changing the shard key) is painful and often requires downtime.
3. Consistent Hashing
A hashing scheme where adding or removing a server only requires remapping a small fraction of keys, rather than reshuffling everything.
Servers and keys are placed on a virtual ring. Each key maps to the nearest server clockwise on the ring.
When to use: Distributed caches (Redis Cluster), distributed databases (DynamoDB, Cassandra), CDN request routing. Any system where nodes are added or removed frequently and you want to minimize data movement.
Trade-off: More complex than simple modular hashing. Can produce uneven distribution without virtual nodes (each physical server maps to multiple positions on the ring).
4. Write-Ahead Log (WAL)
Before writing data to the main storage, write the operation to a sequential log file.
If the system crashes, replay the log on restart to recover incomplete operations.
When to use: Every reliable database uses WAL internally (PostgreSQL, MySQL, Cassandra). Also used for database replication (replicas replay the primary’s WAL) and change data capture (applications read the WAL to react to data changes).
Trade-off: Double-write overhead (write to log, then write to storage). The log grows continuously and needs periodic compaction.
5. Event Sourcing
Instead of storing the current state of an entity, store a sequence of events that happened to it.
The current state is derived by replaying all events.
“OrderCreated → ItemAdded → ItemAdded → PaymentReceived → OrderShipped” reconstructs the order’s current state.
When to use: Systems where audit history is critical (financial systems, compliance-heavy domains). Systems where you need to reconstruct past states (”what did this user’s cart look like 3 days ago?”). Systems where multiple views of the same data are needed (each view derives its state from the event stream).
Trade-off: Querying the current state requires replaying events (solved with snapshots). Event schema evolution is complex (old events must remain readable as the schema changes). Storage grows indefinitely.
6. CQRS (Command Query Responsibility Segregation)
Separate the write model (commands: create, update, delete) from the read model (queries: search, list, aggregate).
The write model is optimized for consistency and validation.
The read model is optimized for fast queries and may use a different database or schema.
When to use: Systems with very different read and write patterns. An e-commerce system might write orders to a normalized relational database but serve the product catalog from a denormalized search index (Elasticsearch).
Trade-off: Increased complexity (two models to maintain, a synchronization mechanism between them). Eventual consistency between the write and read models.








