Sub topic 1
Start with the problem, not the boxes
Prerequisites
This chapter assumes you know the basics of client-server and web architecture, you have used HTTP APIs and databases, and you can read short Python snippets. You do not need to have designed a large system before.
Why the first move matters
A system design prompt is usually one line long: "Design a URL shortener" or "Design a news feed." The line leaves out almost everything you need to know. How many users are there? Who reads and who writes? What happens if the service is down for a minute?
Many people react by drawing boxes right away: a load balancer, a cache, a database, a queue. This feels productive, but the boxes are answers to questions you have not asked yet. A cache helps only if reads dominate. A queue helps only if work can be deferred. Without the problem, you are choosing parts at random.
The process in this tutorial runs in a fixed order:
- Frame the problem.
- Pin down requirements and scope.
- Estimate scale.
- Design the API, the data model, and the architecture.
- Deepen, test, and communicate the design.
This chapter covers step 1.
What framing means
Framing is turning a vague prompt into a problem statement you can check a design against. A good frame answers four questions:
- Who are the users? People, other services, or both. A public mobile app and an internal batch job need different designs.
- What is the core job? The one action the system must do well. For a URL shortener, it is turning a long URL into a short one and redirecting from it.
- What does success look like? Speed, correctness, availability, cost, or something else. These decide what you protect.
- What is out of scope? Anything you will not design this time, such as billing or analytics.
You find the answers by asking. In an interview, ask the interviewer. At work, ask the product owner, the people who will operate the system, and the teams that depend on it. If nobody can answer, state your guess out loud and carry on. Chapter 3 covers how to record assumptions.
A worked example
Take the prompt "Design a service that stores short notes."
A box-first response might be: "Clients talk to an API gateway, then a service, then a NoSQL database with a Redis cache." Nothing in the prompt justified any of that.
A problem-first response asks questions and records the answers:
| Question | Answer (assumed) | Design consequence |
|---|---|---|
| Who uses it? | Signed-in people on phones | Needs authentication and tolerates mobile network delays |
| Core job? | Save a note, read it back | Two main operations, so the API stays small |
| Read or write heavy? | Reads far outnumber writes | Caching and read replicas become candidates |
| Can a note be lost? | Never | Durability outranks raw speed |
| Is it shared? | No, private to the owner | No sharing rules or fan-out to design |
Each answer removes or adds options. The last row, for example, saves you from designing a permissions system. The frame, written as a statement, might read:
"A private note store for signed-in mobile users. Reads outnumber writes. Notes must never be lost. Sharing and search are out of scope."
That statement is short, and you can judge any later decision against it.
Common mistakes
- Starting with technology. Naming a database before you know the access pattern commits you to a choice you cannot defend.
- Asking too many questions. Questions that do not change the design waste time. Ask only what would alter a decision.
- Treating the prompt as complete. Silence in the prompt is not permission to ignore the gap.
- Never revisiting the frame. New information can change the problem. Update the statement when it does, and then check what else changes.
Exercise
You are asked to "design a ride-sharing service." Write three questions you would ask before drawing any component, and for each, say which design decision the answer could change.
Show answer
Example answers. (1) "Is this one city or global?" This affects data partitioning, latency targets, and whether you need multiple regions. (2) "Do we need real-time driver location, or is periodic update enough?" This affects whether you use persistent connections, how often drivers write, and the write load. (3) "Does the system handle payments?" This decides whether you need strong consistency and an audit trail, or whether you can scope payments out. Any questions whose answers change a concrete design decision are acceptable.