Design a URL shortener — System design interview practice (Intermediate)
up to 10 questions · 85 minutes · ₹10
The problem
Design a service like bit.ly. A user pastes a long URL and gets a short link such as rfh.to/aZ3k9Qx; anyone who opens the short link is redirected to the long URL. Owners can see how many times each link was opened.
Redirects are the hot path: they must be fast everywhere and must keep working when parts of the system fail. Creating links is far rarer but must never hand out the same code twice.
Draw the components, the connections between them (what flows, how, and how fast) and the data each part owns. Add your estimates and the API on cards.
Requirements
What it must do
- Create a short link for a long URL, optionally with a custom alias
- Redirect a short link to its long URL (HTTP 301/302)
- Links can have an expiry date; an expired link answers 410
- Owners see click counts per link, at most a minute behind
How well it must do it
- Redirect p99 under 50 ms worldwide
- 99.95% availability for redirects
- A short code is never reused or handed out twice
- Keep links for 5 years
Scale
100M redirects and 10M new links a day; peaks at 10x the average; read to write about 10:1
Out of scope
- User accounts, login and billing
- Malware and phishing scanning of target URLs
- A web UI beyond the API
What you'll be asked
You design for 45 minutes on a canvas: components, connections and notes. Then you answer up to 10 questions: 5 about the scenario (what happens under load, when a part fails, as it grows) and 5 about the design you drew. Answer at least 3 to finish; each has about 4 minutes.
Interview format
- Design: 45 minutes on the canvas
- Questions: up to 10 questions, about 4 minutes each
- Time: 85 minutes at most
- Difficulty: Intermediate
- Device: best on a laptop or desktop; the canvas needs a wide screen
- Price: ₹10 a test
How it's marked
- Requirements and estimates
- Fast, scalable redirects
- Unique code generation
- Data model and storage
- Reliability and analytics
Your diagram and your answers are both marked, against 5 areas: Requirements and estimates, Fast, scalable redirects, Unique code generation, Data model and storage, Reliability and analytics. Every answer gets what it got right and what it missed, with a strong answer to compare. The result comes by email and WhatsApp once it is marked.
Sample question
Your short codes are 7 base62 characters. How many links does that allow, and how long does the space last at 10 million new links a day?
Take the Design a URL shortener test
What it covers
- caching
- sharding
- id-generation
- analytics
Frequently asked questions
- How long is the Design a URL shortener test?
- 85 minutes at most: 45 minutes to design, then up to 10 questions.
- What will I be asked in the Design a URL shortener test?
- You design for 45 minutes on a canvas: components, connections and notes. Then you answer up to 10 questions: 5 about the scenario (what happens under load, when a part fails, as it grows) and 5 about the design you drew. Answer at least 3 to finish; each has about 4 minutes.
- How is the Design a URL shortener test marked?
- Your diagram and your answers are both marked, against 5 areas: Requirements and estimates, Fast, scalable redirects, Unique code generation, Data model and storage, Reliability and analytics. Every answer gets what it got right and what it missed, with a strong answer to compare. The result comes by email and WhatsApp once it is marked.
- Can I take the Design a URL shortener test on my phone?
- It is best on a laptop or desktop: the design canvas needs a wide screen. The readyforhires app opens it in your browser.
- Is the Design a URL shortener test free?
- It costs ₹10 a test, paid per test with no subscription. Prices in Indian rupees (INR).