Building blocks
The concepts every large system is assembled from. Each is explained once and linked from every design that uses it.
Networking & edge
Adaptive Bitrate Streaming
Adaptive bitrate (ABR) streaming encodes each video at several resolutions and bitrates, cuts them into short segments, and lets the player pick the best version its connection can sustain, switching segment by segment. Viewers on slow networks get lower quality instead of a frozen picture.
Used in Twitch
API Gateway
An API gateway is the single front door to a set of backend services. It routes each request to the right service and handles cross-cutting concerns such as authentication, rate limiting, retries and protocol translation in one place.
Used in Netflix, News Feed, Notification Service, Rate Limiter, Uber
CDN
A content delivery network stores copies of static content such as video segments, images and scripts on servers close to users, so bytes travel a short distance and the origin only serves cache misses.
Used in Chat System, Cloudflare, Netflix, News Feed, Slack, Twitch, WhatsApp, YouTube
Load Balancer
A load balancer spreads incoming requests across a pool of servers so no single machine is overwhelmed, and routes around servers that fail their health checks. It is the entry point that makes horizontal scaling possible.
Used in Chat System, Cloudflare, Netflix, News Feed, Rate Limiter, Shopify, URL Shortener, WhatsApp
WebSockets & Persistent Connections
WebSockets keep a single, long-lived, two-way connection open between client and server, so the server can push messages the moment they happen instead of waiting for the client to poll. They power chat, live updates and real-time dashboards.
Used in Chat System, Discord, Figma, Notification Service, Slack, Uber, WhatsApp
Storage
Bloom Filter
A Bloom filter is a compact bit array that answers 'is this key in the set?' with either 'definitely not' or 'probably yes'. It never gives false negatives, uses a few bits per key, and lets a system skip expensive lookups for keys that don't exist. Cloudflare's Quicksilver answers 99% of its negative lookups this way, without touching disk.
Used in Cloudflare
Erasure Coding
Erasure coding protects data by splitting it into k data shards and computing m extra parity shards, so the original can be rebuilt from any k of the k + m shards. It survives the loss of m disks for far less extra storage than keeping full copies, which is why large object stores use it.
Used in Amazon S3, Dropbox
Inverted Index
An inverted index maps each word to the list of documents that contain it, so a search engine can answer a query by reading a few short lists instead of scanning every document. It is the core data structure behind web search and full-text search engines.
Used in Discord, Google Search, Twitter (X)
Object Storage
Object storage keeps large, unstructured files such as videos, images and backups as immutable objects addressed by a key, with near-unlimited capacity and very high durability. Amazon S3 is the reference example.
Used in Amazon S3, Chat System, Dropbox, GitHub, Netflix, News Feed, Spotify, WhatsApp
Online Migrations
An online migration moves data to a new table, schema or database while the application keeps running. The common recipe: write to both old and new, backfill history, verify with shadow ('dark') reads, switch reads, switch writes, then remove the old path. Stripe, Notion, Figma and Slack have all described versions of it.
Used in Figma, Notion, Slack
Quorum Replication
Quorum replication keeps N copies of each piece of data and treats a write as successful once W of them confirm it, and a read as answered once R of them reply. Choosing W and R so that R + W > N means every read overlaps the latest write, while a minority of slow or failed replicas never blocks progress.
Used in Discord, GitHub
Write-Ahead Log
A write-ahead log (WAL) records every change in an append-only log before the change is applied to the data itself. A commit only has to flush the sequential log, not the scattered data pages, and after a crash the database replays the log to redo anything that hadn't reached the data files. Replication protocols ship the same log to replicas.
Used in Amazon DynamoDB, Google Spanner
Caching
Messaging
Reliability
Circuit Breaker
A circuit breaker stops a service from repeatedly calling a dependency that is failing. After too many errors it fails fast, often with a fallback, and later lets a few trial requests through to see whether the dependency has recovered.
Used in Netflix, Notification Service, Uber
Idempotency Keys
An idempotency key is a unique value the client sends with a request that changes state, so the server can recognise a retry and return the original result instead of doing the work twice. It is what makes it safe to retry a payment after a timeout.
Used in Adyen, Stripe
Replication
Replication keeps copies of the same data on several machines, so the system survives a server or data-centre failure and can serve more reads. The key choices are who accepts writes and whether replicas are updated synchronously.
Used in Adyen, Chat System, Cloudflare, Dropbox, Facebook, GitHub, Netflix, News Feed, PayPal, Stripe, Uber, URL Shortener, WhatsApp
Saga & Transactional Outbox
Two patterns for keeping data consistent across services without distributed transactions. A transactional outbox saves the outgoing message in the same database transaction as the change, so a message is sent if and only if the change commits. A saga chains local transactions and undoes completed steps with compensating transactions when a later step fails.
Used in Adyen
Scaling data
Database Sharding
Sharding splits one large dataset across many database servers, each holding a subset of the rows chosen by a shard key. It lets storage and write throughput grow beyond what a single machine can handle.
Used in Adyen, Amazon DynamoDB, Chat System, Discord, Dropbox, Facebook, Figma, Google Search, Google Spanner, Netflix, News Feed, Notion, Shopify, Slack, Stripe, Twitter (X), Uber, URL Shortener, WhatsApp, YouTube
Fan-out on Write vs. Read
Fan-out is how one event reaches many recipients. Fan-out on write pushes a post into every follower's precomputed timeline when it is created; fan-out on read assembles a timeline from the people you follow when you open the app. Large feeds use a hybrid.
Used in Chat System, Discord, News Feed, Notification Service, Slack, Spotify, WhatsApp
Concepts
CAP Theorem
The CAP theorem says that when a network partition splits a distributed system, it must choose between consistency (every read sees the latest write) and availability (every request gets a non-error answer). It cannot guarantee both during the partition.
Used in Chat System, Netflix, Uber
Cell-Based Architecture
A cell-based architecture splits a system into many independent copies, called cells or pods, each serving a subset of customers with its own data and dependencies. A failure, bad deploy or overload in one cell affects only that cell's customers, and capacity grows by adding cells.
Used in Shopify
Collaborative Editing (OT & CRDTs)
Collaborative editing lets several people change the same document at once and still end up with identical copies. The main approaches are operational transformation (OT), conflict-free replicated data types (CRDTs), and simpler server-ordered schemes like Figma's, where a central server orders changes and each property is last-writer-wins.
Used in Figma
Consensus (Paxos & Raft)
Consensus lets a group of servers agree on one value, or one sequence of log entries, even when some of them crash. Paxos and Raft do it with majorities: any two majorities overlap, so once a majority has accepted something, no later majority can decide differently. It is how replicated databases keep their copies identical.
Used in Amazon DynamoDB, Google Spanner
Double-Entry Ledger
A double-entry ledger records every movement of money as balanced debits and credits that are never edited, only appended. Because every entry has an equal and opposite side, the books always sum to zero, which turns "is our money correct?" into a check a computer can run.
Used in Adyen, Stripe
Two-Phase Commit
Two-phase commit (2PC) makes a transaction that touches several databases or partitions commit everywhere or nowhere. A coordinator first asks every participant to prepare, then tells all of them to commit only if every one said yes. Its weakness is blocking when the coordinator fails, which systems like Spanner avoid by making each participant a replicated Paxos group.
Used in Google Spanner
Algorithms
Consistent Hashing
Consistent hashing maps keys and servers onto the same circular hash space, so each key belongs to the next server clockwise. Adding or removing a server only moves the keys next to it, instead of reshuffling almost everything like hash mod N.
Used in Chat System, Cloudflare, Discord, Facebook, Google Zanzibar, News Feed, PayPal, Rate Limiter, Slack, Uber, URL Shortener, WhatsApp
Geospatial Indexing
A geospatial index turns a latitude and longitude into a cell ID in a grid, so 'what is near me?' becomes a fast lookup of a few cells instead of a scan of every point. Geohash, S2 and Uber's hexagonal H3 are common grids.
Used in Uber
Rate Limiting Algorithms
Rate limiting caps how many requests a client may make in a period, protecting services from abuse and overload. The main algorithms are token bucket, leaky bucket, fixed window, sliding log and sliding window counter, each trading accuracy against memory.
Used in Amazon DynamoDB, Notification Service, Rate Limiter, Stripe, Uber
Unique ID Generation
Distributed systems need unique IDs without a single database sequence becoming a bottleneck. Snowflake-style IDs pack a timestamp, a machine ID and a sequence number into 64 bits, so every server can mint sortable IDs independently.
Used in Chat System, Discord, News Feed, Twitter (X), URL Shortener