Dev Guide

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

  1. 1
    Why No Single Database Works

    Why real systems combine several kinds of databases.

  2. 2
    CAP Theorem

    The trade-off every distributed system has to make.

  3. 3
    Designing an E-Commerce Platform

    A complete design that brings the core ideas together.

1

Why No Single Database Works

Why using one relational database for everything breaks down as an app grows — and how polyglot persistence fixes it.

7 min read
2

CAP Theorem

During a network partition, a distributed system can guarantee at most two of Consistency, Availability, and Partition Tolerance.

7 min read
3

PACELC Theorem

CAP only describes what happens during a partition — PACELC covers the trade-off a system faces the rest of the time.

7 min read
4

Cache Invalidation Patterns

Cache-Aside, Write-Through, and Write-Behind — three different answers to who updates the cache, and when.

7 min read
5

Replication Strategies

Leader-follower, multi-leader, and leaderless replication — three different answers to how copies of the same data stay in sync.

7 min read
6

Sharding Strategies

Hash-based, range-based, and directory-based sharding — three ways to decide which shard a row actually lives on.

7 min read
7

Distributed Transactions

Two-Phase Commit and the Saga pattern — two very different ways to keep a transaction consistent across multiple services or shards.

8 min read
8

Consensus Algorithms

How Raft and Paxos let distributed nodes agree on a single value — like who's the leader — despite failures.

7 min read
9

The Dual-Write Bug & CDC

Writing to a database and a cache as two separate steps looks fine — until the process crashes between them.

7 min read
10

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.

9 min read
11

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.

8 min read
12

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.

8 min read
13

Designing an IoT Telemetry Pipeline

A hundred thousand sensors reporting once a second don't care whether your database is ready for them.

8 min read
14

Choosing a Storage System

56 chapters of trade-offs, distilled into the four questions that actually decide which storage system belongs in your architecture.

9 min read