System design · spoken drill
Free URL Shortener System Design Interview in English
A URL shortener is two paths: write a long URL, redirect a short code. Name how you mint the ID, where you store the map, and what you do on a collision.
The prompt
Design a URL shortener like bit.ly. In 60–90 seconds, in English, cover the two API calls, how you generate the short code, where you store it, and one thing that breaks at scale.
How to explain it
1.Requirements
Who the user is, and what must work on day one. Clarify identity, write vs read, and one thing you are not building yet.
2.Scale
One rough number you can say out loud. QPS, storage, or “millions of keys.” The number can be rough. The sentence cannot be missing.
3.API
Name the two or three calls. “I would expose allow(userId) and a 429 when they are over the limit.”
4.Data
Where the state lives. Cache, database, or log. Say why that store, not a tool dump.
5.Bottleneck
What breaks first when traffic grows. Hot key, single leader, clock skew. Invite a follow-up.
6.Trade-off
What you gain and what you give up. Accuracy vs speed, consistency vs availability. One pair is enough.
- “I would start with two calls: create, and redirect.”
- “Reads are the scale problem, so I would cache popular codes.”
- “The bottleneck is a viral link hitting one key.”
Practise out loud
Record 60–90 seconds. Play it back, then get a scorecard. Audio is scored and discarded.
This browser cannot record audio. Type your explanation below.
0:00 / 1:30Have a diagram already? Explain my diagram on the hub.
Model spoken script
I would start with two calls: create a short link, and redirect on GET. I need unique codes and a fast read path. I would generate a compact ID, encode it, and store long URL to code in a key-value store. Reads are the scale problem, so I would cache popular codes. The bottleneck is collisions if the generator is naive, or a hot key on a viral link. The trade-off is a random ID — simpler, uglier — versus a counter, which is sequential and easier to guess.
How to explain a URL shortener out loud, step by step
In one sentence: You have to design a service that turns a long web address into a short code and sends anyone who opens that code to the original address.
What to say, in order
- “There are two core operations: create a short link from a long URL, and redirect from a short code to the long URL. I'd also ask about custom aliases and expiry.”
- “Reads dominate — one link can be opened many times — so I'll optimise the redirect path.”
- “For the API: a POST that takes the long URL and returns the code, and a GET on the code that answers with a redirect.”
- “To generate codes, I'd take a unique numeric ID and encode it in base 62 — digits plus upper- and lower-case letters. Seven characters give about 3.5 trillion combinations.”
- “The mapping from code to long URL goes in a key-value store, and I'd put a cache in front of it for popular codes.”
- “For the redirect itself, a 301 lets browsers cache it and reduces load, while a 302 sends every click through us, which keeps click analytics accurate. I'd pick based on whether we need analytics.”
Key English phrases for a URL shortener
- read-heavy
- — far more redirects than creations
- base62 encoding
- — writing a number using 0–9, a–z and A–Z
- 301 vs 302 redirect
- — permanent and cacheable vs temporary
- collision
- — two long URLs getting the same short code
- hot key
- — one code receiving a huge share of traffic
How to say the time and space complexity
“A redirect is one key lookup, so it's O(1) per request, and most popular codes should be served from cache. Storage grows linearly with the number of links, so I'd estimate it from links created per day times the bytes per record, and state those assumptions out loud.”
Give estimates as a method with stated assumptions, not as a precise number you can't justify.
Communication mistakes on a URL shortener
- Mistake: Hashing the URL and truncating it without mentioning collisions. Instead: Say 'a truncated hash can collide, so I'd check and retry — or use a counter-based ID, which can't collide.'
- Mistake: Never deciding between 301 and 302. Instead: Make the call and give the reason: caching versus analytics.
- Mistake: Spending most of the time on the write path. Instead: Say early that reads dominate and design the redirect path first.
Likely follow-up questions
Interviewer: “How do you generate unique IDs across many servers?”
You: “Each server can reserve a block of IDs from a central counter, for example a thousand at a time, and hand them out locally. Or I can use a Snowflake-style ID. Both avoid a round trip per link.”
Interviewer: “Sequential codes are guessable. Is that a problem?”
You: “It can be, because someone could enumerate links. I'd shuffle the ID with a reversible mixing function before encoding, or use random codes with a collision check, depending on how private links need to be.”
Other prompts
Spoken outline
Rate limiter
A rate limiter is a “who, how many, what happens at the limit” story. Clarify identity, pick token bucket or a window, place it before expensive work, then name fairness.
Spoken outline
URL shortener
A URL shortener is two paths: write a long URL, redirect a short code. Name how you mint the ID, where you store the map, and what you do on a collision.
Spoken outline
Unique ID generator
Unique IDs are a “unique, roughly ordered, and cheap to mint” story. Name a Snowflake-style split, then clock skew — that is the follow-up they will ask.
FAQ
Questions
More questions? Email us at contact@mocklyenglish.com.
Article: How to design Pastebin in English · System design English
Quick answer
Explain system design in English with a spoken order: clarify requirements, give one scale number, name the API, say where state lives, name what breaks first, then one trade-off. Short sentences beat a silent diagram.
Related in this path
People like you
Practise in the course
Think out loud in English