Building Projects

Reading about system design is not the same as building. These chapters take a product from requirements to a working design, with the decisions and failure modes made explicit.

Most build guides stop at the architecture diagram. That is the easy part. The work that decides whether a project survives contact with users is everything after the diagram: what happens when the same request arrives twice, what the system does when a dependency is slow, who cleans up after a failed job, which invariant the code is allowed to violate under load, and how an operator knows what to do at 3 a.m.

Each build therefore covers:

  1. Scope — what is in and out for v1.
  2. Actors and journeys — who uses it and what they are trying to finish.
  3. Invariants — what must never be true, even during a partial failure.
  4. Estimates — load, storage, bandwidth, and the number that will break first.
  5. End-to-end flows — the happy path plus the branches that matter.
  6. Data model and state — keys, indexes, transitions, and retention.
  7. Edge cases — the awkward inputs and races that produce support tickets.
  8. Failure and recovery — what degrades, what fails closed, and how to get back.
  9. Operations — deploy, migration, backfill, monitoring, and incident process.
  10. Testing — what to test deliberately instead of hoping production finds it.
  11. Milestones — what to build in which order, with acceptance criteria.
  12. Review checklist — the questions a senior reviewer would ask.

The builds

Build Core challenge What makes it hard
URL Shortener ID generation, redirect latency, abuse A read-heavy path that must stay correct when caches and databases disagree
Chat System ordering, delivery, presence, fan-out Per-conversation order and offline sync across unreliable connections
News Feed fan-out on write vs read, ranking Keeping a derived feed consistent enough while celebrities and deletes break the assumptions
Video Streaming ingestion, transcoding, CDN economics Long-running jobs, large objects, and a cost curve that punishes every shortcut
Todo CLI small scope done rigorously Every production habit in a program with no server to hide behind
Web Server from Scratch protocol parsing, concurrency, limits One parser bug becomes a security incident or a hung process

How to read a build

Do not read these as designs to copy. Read them as a sequence of decisions:

  1. Write the user journey and the invariants before choosing components.
  2. Estimate the load and identify the first bottleneck.
  3. Draw the happy path, then draw the failure branches.
  4. For every queue, cache, and external call, decide what happens when it is slow, down, or returns a duplicate.
  5. Define the recovery procedure before you need it.
  6. Build the smallest vertical slice and add the failure handling you would actually page on.

A build is not finished until…

  • The critical path is implemented end to end (not just diagrammed).
  • The data model has keys and indexes matching the queries.
  • Every write is idempotent, or the system has a documented way to reconcile duplicates.
  • Every external call has a timeout, and retries are bounded.
  • There is a load test at the target scale, or a documented reason it is infeasible.
  • Failures are simulated: dependency down, slow, duplicate delivery, restart, partial write.
  • Inputs are validated; outputs and queues are bounded.
  • Logs, metrics, and traces answer "what happened to request X?".
  • A runbook exists for the top three failure modes.
  • Deletes, expiry, and retention have an owner and a test.
  • The README explains how to run it and what was intentionally left out.

How to use these chapters

Use each chapter as a checklist, not a template:

  1. Write your own requirements and estimates.
  2. Sketch the data model and API before the architecture.
  3. Build the smallest vertical slice.
  4. Add the failure handling you would page on.
  5. Compare your decisions with the chapter and note the differences.
  6. Run the review questions with someone who did not build it.

The best sign that a build guide worked is not that you copied it. It is that you can explain why your design differs.