The system design method
Six steps, in a fixed order, from a vague request to a design you can defend: ask, estimate, define, draw, dig, decide. Worked on StayHub's new reviews feature.
The lesson in text
Click a paragraph to hear it.01Boxes before questions
Tuesday morning at StayHub. Maya, our product manager, wants guest reviews on every hotel page, in four weeks. Ten minutes into the meeting, the whiteboard already shows Kafka, Cassandra and five new services. Those are big tools, built for very big systems. It looks serious.
Then Lina, our senior engineer, asks one simple question: how many reviews do we get a day? Nobody knows. The whole design was drawn before anyone asked.
In this lesson you'll learn the method senior engineers use instead: six steps, in a fixed order, from a vague request to a design you can defend. And when Claude Code proposes an architecture, that order is exactly what you check.
02An architect
Think of an architect designing a house. A good one doesn't start with the floor plan. First, she asks questions. How many people will live here? Does anyone work from home? How cold are the winters?
Then she does a little maths. Five people, two showers a day each: that's the size of the water heater. She decides where the doors, the windows and the sockets go. Only then does she draw the plan.
Next, she looks hard at the parts where a mistake is expensive: the foundations, the staircase. And finally she tells the client what she chose and what it costs. An open kitchen is friendly, but noisier.
Designing software works the same way, in six steps: ask, estimate, define, draw, dig, and decide. Each step gives the next one what it needs. Skip one, and you're guessing.
| Step | The architect | Your design | It gives you |
|---|---|---|---|
| 1 · Ask | Who lives here? Cold winters? | What it does, and how well | Requirements |
| 2 · Estimate | 5 people × 2 showers a day | Reviews a day, page views a second, storage | The size of the problem |
| 3 · Define | Doors, windows, sockets | The API and the data table | The contract |
| 4 · Draw | The floor plan | The boxes and arrows | The high-level design |
| 5 · Dig | Foundations, staircase | The hardest one to three parts | Where it would break |
| 6 · Decide | Open kitchen: friendly, noisier | What we chose, gave up, and when we'd revisit | A decision you can defend |
03Step 1 · Ask
Step one: ask. Who uses it, what do they do, and what's out of scope? For reviews: only guests who finished a stay can write one. Text and photos. Hotels can reply. Translation? Not now.
Those are functional requirements: what the system does. Write them as a short list. Each line is something a guest or a hotel can do.
Then come the questions most people forget: how well must it work? These are non-functional requirements. How fast, how available, how safe with the data, and how much it may cost.
For reviews, Maya and Lina agree on three. The reviews part of the page loads in under 200 milliseconds. A review a guest submits is never lost. And a new review may take a few minutes to appear.
- · Guests with a finished stay write a review (one per booking)
- · Text and photos
- · Hotels can reply
- · Out of scope for now: translation
- · The reviews part of the page loads in under 200 ms
- · A submitted review is never lost
- · A new review may take a few minutes to appear
Here's the surprise. Two systems with the same features can need completely different designs. The features say what to build. The "how well" decides the architecture.
04Step 2 · Estimate
Step two: estimate. Turn the requirements into a few rough numbers, the way the architect counts showers. Not exact numbers. The right size.
StayHub gets about 2,500 bookings a day, and roughly 30% of guests leave a review. That's 750 reviews a day. A day has 86,400 seconds, so that's one new review every two minutes.
Reading is bigger. Hotel pages are opened about 120,000 times a day: about 1.4 times a second on average. At the busiest moment, say ten times more: about 14 a second.
Each review's text is about one kilobyte. So a whole year of reviews is under 300 megabytes. That would fit on your phone.
2,500 bookings × 30% = 750 reviews a dayhow many writes86,400 s ÷ 750 ≈ 115 sone review every two minutes120,000 page views ÷ 86,400 s ≈ 1.4 a secondaverage reads1.4 × 10 ≈ 14 a secondthe busiest moment750 × 1 KB × 365 ≈ 274 MB a yearunder 300 MB of text→ one table in the PostgreSQL we already runno Kafka, no CassandraNow the most important habit: every number must change something. One write every two minutes? A single table in the database we already run handles thousands a second. So Kafka and Cassandra are ruled out by the numbers, not by taste.
05Step 3 · Define
Step three: define the contract, the way the architect places the doors and windows. What can the outside world ask the system? That's the API: get a hotel's reviews, get its rating summary, post a review.
Writing it down raises questions right away. Can anyone post a review? No: the request must carry a booking number. And checking for spam takes time, so the answer is "received, pending", not "published".
Then the data. One table of reviews, shaped around the question it will be asked most: the newest reviews for this hotel. And one rule the database enforces by itself: one review per booking.
GET /hotels/42/reviews?sort=newesta hotel's reviewsGET /hotels/42/rating-summarythe average, for every pagePOST /reviews { "bookingId": "b_5521", "rating": 9, "text": "…" }only with a booking202 Accepted { "status": "pending" }received, not yet publishedreviews(id, hotel_id, booking_id, rating, text, status, created_at)one row per reviewUNIQUE (booking_id)one review per booking, enforced by the databaseINDEX (hotel_id, status, created_at)the most asked question: newest reviews for this hotel06Step 4 · Draw
Step four: draw the boxes. Only now, and only the boxes that a requirement or a number asks for.
The guest's browser calls the StayHub app we already run, which gets a new reviews module. Reviews go into our PostgreSQL database. Photos go to file storage, and the CDN serves them from copies close to the guests.
Spam checks run in the background, so the guest gets an instant thank you. And every box points back to something: the CDN to photo traffic, the background job to "never lost" and "within minutes".
| Box | Why it's there |
|---|---|
| Reviews module in the existing app | One write every two minutes needs no new service |
| The PostgreSQL we already run | Under 300 MB a year; one review per booking is a database rule |
| File storage + CDN for photos | Photo bytes are the heavy traffic; they stay off our app servers |
| Background job for spam checks | "Never lost" and "visible within minutes": the guest gets an instant thank you |
| Cache for the rating summary | The 200 ms target on every hotel page (step 5) |
Now compare with the whiteboard: Kafka, Cassandra, five services. Not one of those boxes pointed to a requirement. That's how you spot over-engineering: ask each box, which number needs you?
07Step 5 · Dig
Step five: dig into the hardest part, like the architect checking the foundations. You only have time for one to three parts, so pick the place where heavy load, real risk and a stated target meet.
For reviews, it isn't posting. That happens every two minutes. It's reading. Every hotel page shows an average rating, and it has to load in under 200 milliseconds.
The naive way computes the average over a hotel's 3,000 reviews on every page view: about 90 milliseconds, on the same database as checkout. The better way: when a review is approved, update one small summary row, and keep a copy in a cache, a fast memory for answers that are asked again and again. Now each page view costs about 2 milliseconds.
Notice the trick: do the work on the rare event, a new review, not on the frequent one, a page view. The price is that the rating can be a few minutes behind. And the requirements said that's fine.
08Step 6 · Decide
Step six: decide, out loud. Say what you chose, what you gave up, and what would make you change your mind.
Karim, our CTO, pushes back: investors will ask about ten times growth, so build reviews as a separate service now. Lina does the maths. At ten times, that's one review every twelve seconds, and about 140 page views a second. Still one table.
So the decision: a module in the app we have, with a clean boundary, plus a written trigger: revisit if reviews pass 50 writes a second. What was given up is on paper, and nobody has to guess later when the design stopped fitting.
09When a step is skipped
What happens when a step is skipped? Omar, our on-call engineer, remembers last July. The deals page had been designed for its average traffic: about three requests a second.
Then marketing sent a summer-sale email to 400,000 people. Four hundred requests a second, each running a heavy query on the main database. The database hit its limit, checkout waited in line behind the deals page, and bookings failed in the best sales hour of the month.
One line in the design would have caught it: the peak. Always estimate the busiest moment, not just the average, and write down what it changes.
10Your job as lead
When you ask Claude Code to design a feature, ask for the six steps, in order, in a short design doc, before any code. And give it your real numbers. Never let it invent the traffic.
Then check three things. Does every box name the requirement or the number that needs it? Did it estimate the peak, not only the average? And does it say what it gave up?
Let's recap: ask, estimate, define, draw, dig, decide. Questions first, then numbers, then boxes. Below the video you'll find the text, the diagrams and ten questions. In the next lesson, we get fast at the numbers themselves.
Check yourself
0/10 answered1Which of these is a non-functional requirement for StayHub reviews?
2Why does the method estimate before it draws any boxes?
3Claude Code's design doc for reviews opens with "Kafka, Cassandra, five services" and says "Estimates: to be done after the architecture is agreed." What do you ask for?
4StayHub gets about 750 reviews a day. Roughly how often does a new one arrive?
5Two teams build a reviews feature with exactly the same features, but end up with very different designs. Why can both be right?
6You have time to dig deep into one part of the reviews design. Which one?
7The summary row is updated when a review is approved, and cached. What did the design give up?
8The deals page was designed for about 3 requests a second. A sale email brought 400 a second and checkout failed. Which step was missing?
9Karim wants reviews built as a separate service now, "for 10× growth". At 10×, reviews are one write every twelve seconds. What's the best answer?
10You review a design Claude Code drew. Which question catches over-engineering best?
Save your progress — create a free account
Free. No card. Your finished lessons follow you to any device, and you can ask questions in the community.
Create my free accountEvery lesson is free while we build. Lock in €9/month for later.
The first 100 members keep the founding price for as long as they stay. Reserving is free: no card, nothing is charged.
See the founding offer