Systems

Design walkthroughs of the systems behind familiar products, each written to the depth of a real thirty-minute interview answer. A system design interview gives you about half an hour to take a vague prompt and turn it into a defensible architecture, and these write-ups follow that same arc. Each one starts by agreeing on scope, turns vague scale into concrete numbers, sketches the architecture with a diagram, and then spends most of its time where a real interview is decided, in the deep dives on the parts that are genuinely hard, before closing with the follow-up questions an interviewer tends to ask. The designs range from classic warm-ups like a URL shortener to payment systems, stock exchanges, and the machine learning systems behind search and recommendations, and the summary under each title says what the design is really about, so the list reads as a study guide on its own.

The ideas behind every design

Almost every system in this collection is assembled from the same small kit of concepts. Horizontal scaling means adding identical servers rather than buying a bigger one, with a load balancer spreading requests across them, and it works because the servers are kept stateless, holding no per-user state between requests. Caching keeps recently used data in fast memory so most reads never touch the database. Partitioning, often called sharding, splits data too big for one machine across many, usually by hashing a key, while replication keeps copies of each partition on several machines so one failure loses nothing. Those copies introduce the central trade of distributed systems, which is consistency against availability. When replicas disagree, the design has to choose between answering with possibly stale data and refusing to answer until the replicas agree, and there is no third option. Message queues decouple fast producers from slow consumers so heavy work happens asynchronously, off the path a user is waiting on. And indexes, from B-trees to inverted indexes to geospatial cells, are how anything is found quickly inside all that data.

ClientLoad balancerStateless servicescale by adding copiesCachehot data in memoryDatabasepartitioned, replicatedMessage queueasynchronous workWorkersdrain the queue, build viewsreadon misswriteevents

The kit of parts nearly every design below assembles. Reads are answered from memory when they can be, writes land in partitioned and replicated storage, and anything slow rides the queue so a user never waits on it. Dashed arrows are taken only sometimes or asynchronously.

The walkthroughs themselves run the way the conversation runs in an interview, in four moves. First agree on scope, because "design YouTube" means nothing until upload, playback, and scale are pinned down. Then turn vague scale into numbers with back-of-the-envelope arithmetic, since 100 million new links a month sounds enormous but works out to about 40 writes per second, and the numbers decide which problems are real. Then sketch the whole architecture, from clients and load balancers through stateless services and caches down to partitioned, replicated storage and the queues that carry asynchronous work off the critical path. Only then go deep on the two or three places where that particular system is genuinely hard, which is where an interview is actually decided, and close with the follow-up questions an interviewer tends to ask next.

1 · Scopepin down what to build2 · Numberssizing arithmetic3 · Architectureone end-to-end diagram4 · Deep divesthe hard parts, in depthfeatures in, features outwrites per second, storage, cacheclient to storage, end to endtrade-offs defended with numbers

The four moves of a thirty-minute design conversation. Each move earns the next, and the deep dives at the end are where the interview is actually decided.

Key takeaway: There is no perfect architecture, only trade-offs chosen deliberately. A strong design states its requirements in numbers, picks the simplest thing that meets them, and can say exactly what breaks first when load grows tenfold and what it would change then.

Classic starters

The questions that open most interview loops, small enough to finish and deep enough to show judgment.

Distributed building blocks

The components that larger designs are assembled from. Knowing these well makes every other question easier.

Search and discovery

How large systems find things, from crawling and indexing the web to completing a query as a person types and searching a social graph by relationship.

Social and messaging

Feeds, timelines, notifications, and the different shapes a message can take, from durable chat history to messages that disappear.

Media and storage

The designs that move and keep large content, covering video upload and playback, file sync across devices, and the object store that sits underneath both.

Location and maps

Systems built around location, including nearby search, live location sharing among friends, road routing with traffic, and matching riders to drivers.

Data pipelines and observability

High-volume event streams and what gets computed from them, including the monitoring that watches everything else.

Reservations and money

Systems where correctness is the product itself, because double-booking, double-charging, and double-spending all have to be impossible by construction.

Machine learning systems

Design questions where a model sits inside a larger system, and most of the work is framing the task well, gathering features and training data, and building a serving path that answers in milliseconds.

Off the beaten path

A design exercise for the fun of it, where the speed of light becomes the bottleneck.