A repeatable design sequence
Outline any design in seven steps (requirements, estimates, API, data model, high-level design, deep dives, trade-offs), see why each step needs the one before, run the photo-sharing service through them, and loop back when a later step breaks an earlier one.
Contentsand lesson path
On this page
- Why it matters
- Seven steps, each feeding the next
- The photo service, step by step
- When a later step breaks an earlier one
- Check your understanding
- Apply it
- Review prompt
Lessons of Requirements & Estimation
- From prompt to requirements: users, use cases and non-goals Concept · 20 min
- Non-functional targets you can test Concept · 15 min
- Numbers to carry in your head: latency, throughput, powers of two Concept · 20 min
- Estimating a photo-sharing service end to end Worked example · 30 min
- A repeatable design sequence Concept · 15 min
- Estimation drill Knowledge check · 10 questions
What you will learn
- Outline a design in a repeatable sequence: requirements, estimates, API, data model, high-level design, deep dives, trade-offs.
01. Why it matters
Once requirements and estimates are on the page, it is tempting to jump to the parts you enjoy: a favourite database, a clever cache, a message queue. Then someone asks what exactly does the app call? or where does the list of followers live?, and the design has no answer, because nobody decided.
A design sequence is a fixed order of steps in which each step uses what the earlier ones produced. It does not make you more creative. It makes sure the plain, load-bearing decisions are made before the interesting ones, and it lets you show how every choice follows from a requirement or a number. This lesson gives a seven-step sequence, runs the photo-sharing service from lesson 4 through it in outline, and shows what to do when a later step contradicts an earlier one.
Treat it as one common way to organise the work, not as a standard. Interview formats differ between companies and levels, and teams have their own design-document templates. The steps and their order matter more than their names.
02. Seven steps, each feeding the next
- Requirements. Users, use cases, non-goals and measurable targets, as in lessons 1 and 2. Output: the requirements brief.
- Estimates. Load, storage, bandwidth, memory and cost from written assumptions, as in lessons 3 and 4. Output: numbers with ranges, and the biggest risk.
- API. The calls that clients make, with their inputs and outputs. Output: a short list of endpoints or messages. It fixes what the system promises before you decide how.
- Data model. The entities, their keys and the main access patterns: which queries run, how often, and by which key. Output: tables or documents and the queries they serve.
- High-level design. The components and how a request flows through them for each core use case. Output: a diagram and a short paragraph per flow.
- Deep dives. The two or three places where the estimates or targets say the design could fail: a hot path, a large fan-out, the most expensive line of the bill, a hard invariant. Output: a closer design of each, including what happens when a part fails.
- Trade-offs. For each important choice, the alternatives, what you gain, what you give up, and the condition that would make you revisit it. Output: a short list of decisions with reasons.
The order has reasons. Estimates come early because they decide which designs are candidates at all: 30 writes per second fit comfortably on one database, while 300,000 usually do not. The API comes before the data model because the model exists to serve the calls. The data model comes before the diagram because components exist to store and move that data. Deep dives need the whole picture to choose where to dig, and trade-offs compare choices you have actually made.
Step 45-minute interview Design document section
1 Requirements 5 min Context, goals, non-goals, targets
2 Estimates 5 min Capacity and cost
3 API 5 min Interfaces
4 Data model 5 min Data and storage
5 High-level design 10 min Architecture overview
6 Deep dives 10 min Detailed design, failure modes
7 Trade-offs 5 min Alternatives considered, open questions03. The photo service, step by step
Steps 1 and 2 are done: lesson 4 ended with an assumptions table, ranges and a cost model. Step 3 turns the four core use cases into calls. The API design lessons cover naming, status codes and pagination in depth; at this stage a sketch is enough.
POST /v1/photos body: image, caption -> 201 {photo_id}
GET /v1/feed?cursor=... -> 200 {photos: [{id, owner, urls, caption}],
next_cursor}
GET /v1/photos/{photo_id} -> 200 {id, owner, urls, caption, created_at}
PUT /v1/users/{user_id}/follow -> 204Step 4 lists what must be stored and, just as important, how it is read. The access patterns come straight from the calls above.
photos photo_id (key), owner_id, caption, created_at, status
read by photo_id; by owner_id, newest first
follows (follower_id, followee_id) (key)
read: whom does X follow? who follows X?
files object storage key photos/{photo_id}/{size}.jpg
written once by the workers, read through the CDN
feeds cache: user_id -> latest photo_ids, rebuilt when missingStep 5 draws the components and walks each core flow through them. On upload, the API stores the original, writes a metadata row with status processing and puts a resize job on a queue; a worker writes the feed-size copy and the thumbnail and marks the photo ready. On a feed read, the API takes the list of photo ids from the cache, loads their metadata in one batch and returns CDN addresses; the images themselves load from the content delivery network (CDN), not through the API servers.
phone --images--> CDN -------------------> object storage
| ^ ^
| originals | | copies
+--API--> load balancer --> API servers ---+ |
| | | |
| | +--> queue --> resize workers
| +-----> metadata database
+--------> cache (feeds, hot metadata)Step 6 picks deep dives from lesson 4's numbers, not from taste. Image delivery is the dominant cost and up to about 107 Gbit/s at peak, so the CDN and its cache behaviour come first (CDN and edge is a later skill). The upload pipeline comes second, because its resize cost is a guess and phones upload slowly. Third is building feeds for accounts with very many followers, the classic fan-out problem of the news feed case study. Login and profile pages are routine here, so they get no deep dive. Each deep dive also asks what happens when a part fails: a backlog in a queue that stores jobs durably delays new photos but loses none, as long as it clears before the queue's retention limit, while a lost cache makes every feed request hit the database at once.
Step 7 writes each important choice in one form: option, gain, cost, revisit when. For example: photo metadata goes in one relational database with read replicas (copies that serve reads); we gain transactions and simple queries; we give up easy scaling of writes; we revisit if peak writes reach half of what a load test shows one primary can sustain. A trade-off without a revisit condition is an opinion; with one, it is a decision someone can check.
04. When a later step breaks an earlier one
The sequence is a loop, not a line. Suppose the image-delivery deep dive finds that, in the worst case, egress alone costs more than the monthly budget the product team set. Do not hide the conflict until the trade-offs step, and do not quietly change the design so that it no longer meets a requirement. Go back to the step the conflict came from: renegotiate a requirement (a smaller feed image, which lesson 4 showed moves the bill almost as much as views do), revisit the assumption behind the number with a measurement (views per user from a beta), or change the API (send lower-resolution images first on slow connections). Then write down what changed and why.
Google's chapter on non-abstract large system design describes the same pattern: the designer moves back and forth between phases, and each pass produces a candidate design that is tested against the requirements. What makes the process repeatable is not a strict order, but that every change is recorded where the next reader will look for it. The design review framework skill later turns this sequence into a checklist for reviewing other people's designs.
05. Check your understanding
06. Apply it
Finish the practice task for this skill by outlining one of your three prompts through all seven steps on a single page, reusing its brief, targets and estimates:
- An API sketch of three to five calls.
- A data model with keys and the main access patterns.
- An ASCII diagram and one paragraph per core flow.
- Two deep dives chosen from your estimates, each with one failure and what happens then.
- Three trade-offs in the form option, gain, cost, revisit when.
Then time yourself: run a second prompt through the sequence in 45 minutes, and note which step took longest and which loop-backs happened.
07. Review prompt
Without looking back, answer in your own words:
- List the seven steps in order and the output of each.
- Why do estimates come before the high-level design, and the API before the data model?
- How do you choose what to deep-dive into, and what question does every deep dive ask about failure?
- What four parts make a trade-off statement checkable, and what do you do when a deep dive contradicts a requirement?
References
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
10 questions · about 8 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.