The interviewer says four words: "Design a URL shortener."
Then they stop talking. Forty-five minutes are yours, the whiteboard is blank, and the silence is doing real damage to your ability to think.
This lesson gives you something to say in the first thirty seconds, and a structure for every minute after it.
What is actually being assessed
Candidates assume they are being marked on whether they produce the right architecture. They are not, because there is no right architecture. Interviewers are judging four things:
- Do you handle ambiguity? The prompt is deliberately vague. Do you ask, or do you guess?
- Do your decisions follow from requirements? A cache because you calculated a read-heavy load is engineering. A cache because caches are good is recital.
- Do you know what you gave up? Every choice costs something. Naming the cost is the strongest signal available.
- Can you be understood? You will work with these people. Muttering at a whiteboard fails even with a correct design.
The five phases
For a 45-minute interview, budget roughly like this.
Diagram, as text
- 1. Clarify 8 min leads to 2. Estimate 5 min
- 2. Estimate 5 min leads to 3. API + Data 7 min
- 3. API + Data 7 min leads to 4. Design 15 min
- 4. Design 15 min leads to 5. Scale + Fail 10 min
Phase 1 — Clarify (about 8 minutes)
Your goal is a written list both of you agree on before anything is designed.
Functional requirements — what it does. Push for the small number that matter:
"Let me confirm scope. A user submits a long URL and gets a short one back; visiting the short one redirects. Should users be able to choose a custom alias? Do links expire? Do we need analytics on clicks?"
Non-functional requirements — how it must behave. These drive the architecture far more than the feature list:
"How many links created per day? What read-to-write ratio should I assume? Is a redirect that occasionally fails acceptable, or must it be near-perfect? Global or single-region users?"
Out of scope — say it explicitly. It protects your remaining time:
"I will assume no user accounts, no billing, and no spam detection unless you would like those included."
Phase 2 — Estimate (about 5 minutes)
Rough numbers decide whether your design needs one machine or a hundred. Nobody expects precision; they expect you to reason with orders of magnitude.
Work in this order: users, then requests per second, then storage, then bandwidth.
Take 100 million new links a day, read 100 times more often than written:
- Writes: 100M ÷ 86,400 seconds ≈ 1,200 per second
- Reads: 1,200 × 100 = 120,000 per second
- Storage: at ~500 bytes per record, 100M × 500B = 50 GB per day, about 18 TB a year
- Peak: assume 2–3x average, so plan for roughly 300,000 reads per second
Now say what those numbers mean, because that is the actual point:
"Reads outnumber writes a hundred to one, so this is a caching problem more than a database problem. 18TB a year rules out a single machine long-term, so I will need to shard. And 300k reads per second means the redirect path has to avoid touching disk."
Phase 3 — API and data model (about 7 minutes)
Defining the interface forces both of you to agree on exactly what the system does before any boxes appear.
Keep it to two or three endpoints:
POST /api/v1/urls { longUrl, customAlias?, expiresAt? } -> { shortUrl }
GET /{shortCode} -> 302 redirect to the long URLThen the data. State the access pattern first — it justifies the storage choice:
url_mappings
short_code VARCHAR(7) PRIMARY KEY
long_url TEXT NOT NULL
created_at TIMESTAMP
expires_at TIMESTAMP NULL"Every read is a lookup by primary key with no joins, so a key-value store fits naturally. I will keep it relational for now because the data is small and simple, and revisit if we need to shard aggressively."
Phase 4 — High-level design (about 15 minutes)
Only now do you draw. Start with the simplest thing that satisfies the requirements, and say so.
Diagram, as text
- Clients leads to Load Balancer
- Load Balancer leads to App Servers
- App Servers leads to Cache
- Cache leads to Database (miss)
Then walk one request end to end, out loud. This is where most of your marks are earned:
"A redirect arrives at the load balancer and reaches any app server — they are stateless, so any of them can serve it. The server checks the cache; short codes are heavily skewed, so a small cache should absorb most reads. On a miss we read the database and populate the cache. We return a 302."
Explain each choice as you place it, in one sentence: what it does, and why these requirements need it.
Phase 5 — Scale and failure (about 10 minutes)
This phase separates good candidates from great ones. Drive it yourself rather than waiting to be asked.
Find the bottleneck. "At 300k reads per second the single database is the limit, so I will add read replicas and shard by short code."
Remove single points of failure. Point at each box and delete it aloud: "if the cache dies we fall back to the database, which survives but at higher latency. If the load balancer dies everything stops, so we run at least two with failover."
Name the trade-offs you made. "Caching means a recently edited link could serve a stale target for up to the TTL. For redirects that is acceptable; if it were not, I would invalidate on write."
Mention what you would monitor. "P99 redirect latency, cache hit rate, and error rate by status code."
The phrases that earn marks
Specific sentences that signal seniority:
- "Let me start simple and scale it once we see where it breaks."
- "That is a trade-off. I am choosing X, which costs us Y."
- "What breaks first here is…"
- "I do not know that number precisely — may I assume roughly N and adjust?"
- "That is out of scope for now; shall I come back to it if we have time?"
And the ones to avoid: "we would just use Kafka", "it will scale", and any component named without a reason.
Check your understanding
Common mistakes
Designing for a billion users when asked for a thousand. Over-engineering is judged as harshly as under-engineering, because it shows requirements did not drive the design.
Going silent while thinking. The interviewer cannot mark what they cannot hear. Narrate: "I am weighing SQL against a key-value store here…"
Refusing to commit. Listing three options and picking none reads as indecision. Choose one, justify it, and note when you would revisit.
Ignoring the interviewer's hints. "What happens if that server fails?" is not curiosity. It is a gift telling you exactly where to go next.
Running out of time. Watch the clock. A complete simple design beats an unfinished sophisticated one every time.
Practice
You are asked to design a ride-hailing service. Write out the first two minutes of what you would say, before drawing anything.
Write your own answer first, on paper or in a note. Then compare.
Show a hint
Nothing about technology belongs in the first two minutes.
Show a strong answer
Something close to this:
"Before I draw anything, let me pin down what we are building and how big it is.
On scope — I will assume this is the rider-facing path: request a ride, get matched to a nearby driver, track them to pickup. I will treat payments, ratings and driver onboarding as out of scope unless you want them. Is that the right cut?
On scale — say 10 million daily active users, 10% taking one ride a day, so a million rides a day. That is about 10 ride requests a second on average, maybe 30 at peak. But location updates dominate: 100,000 active drivers pinging every 4 seconds is 25,000 writes a second, which is three orders of magnitude larger than the ride requests. So the interesting problem here is the location pipeline, not the booking.
On requirements — matching should feel instant, so a few seconds end to end. Location can be a little stale; a driver's dot being 4 seconds behind is fine. But a ride, once accepted, must not be double-assigned — two drivers arriving for one rider is a real-world failure.
Does that framing match what you had in mind, or would you like me to weight it differently?"
Notice what that did: scoped the problem, produced numbers, found the real bottleneck before drawing, separated what must be strongly consistent from what may be stale, and handed control back. Everything drawn afterwards can now be justified.
Halfway through your design the interviewer says: 'What happens if that database goes down?' You had not planned for it. Describe how to answer well, and what makes the difference between a weak and a strong response here.
Write your own answer first, on paper or in a note. Then compare.
Show a hint
They are not testing whether you prepared. They are testing how you reason when you have not.
Show a strong answer
The weak response is to guess quickly — "we would use a replica" — and move on, or to freeze and say you had not considered it.
The strong response has four parts, in order:
- Say what breaks, specifically. "Writes stop. Reads keep working for anything already cached, which is the feed but not the checkout." This shows you know what depends on that component, which is more valuable than any remedy.
- Separate data loss from unavailability. "With synchronous replication we lose nothing but pause writes; with asynchronous we stay up and may lose the last few seconds." Naming the trade-off is the senior move.
- Pick, and say why. "For orders I would take the pause — a lost order is worse than a slow one."
- Name the cost you just accepted. "That means failover takes longer, and I need to make sure the application handles a read-only period rather than throwing 500s."
The difference is not knowing an answer in advance. It is being able to reason about a failure you have just been handed, out loud, without pretending you had planned for it. Interviewers ask this question precisely because it cannot be memorised.
Key takeaways
- The prompt is deliberately vague. Clarifying is part of the test, not a delay before it.
- Spend the first fifteen minutes on requirements and numbers. They justify everything that follows.
- Estimate before designing — the numbers decide whether you need one machine or a hundred, and saying what they imply is the point.
- Start with the simplest design that meets the requirements, then scale it deliberately.
- Name every trade-off out loud. Knowing what you gave up is the clearest signal of experience.
- Drive failure analysis yourself: find the bottleneck, delete each box in turn, and say what you would monitor.
That completes the fundamentals. From here the course moves into high-level design, where each component in these diagrams gets examined properly — starting with how a request finds your servers at all.
Further reading
- Google SRE, Site Reliability Engineering (O'Reilly, 2016), chapter 6 — the four golden signals, useful vocabulary for the scale-and-failure phase.
- Martin Kleppmann, Designing Data-Intensive Applications (O'Reilly, 2017) — the reference behind most storage decisions you will be asked to justify.
- Sam Newman, Building Microservices, second edition (O'Reilly, 2021) — service boundaries and the questions that decide them.
- Roy Fielding, "Architectural Styles and the Design of Network-based Software Architectures" (doctoral dissertation, 2000), chapter 5 — the constraints behind REST, worth knowing before defending an API shape.
- Michael Nygard, Release It!, second edition (Pragmatic Bookshelf, 2018) — failure modes and stability patterns, the source material for phase five.