SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 01
Design a URL shortener
People paste a long link and get back a short one they can put in a message, a slide, or a printed flyer. Most of the work happens later, when strangers click the short link and expect to land on the right page instantly.
Requirements
- Create a short alias for a valid HTTP or HTTPS URL.
- Redirect a visitor who opens an existing alias.
- Return a clear error for an unknown or disabled alias.
Constraints and assumptions
- 10 million new aliases a month; roughly 100 redirects per alias over its lifetime.
- Aliases should be at most 8 characters and must never be reused for a different URL.
- A redirect should feel instant: aim for p99 under 50 ms at the server.
- Links can be disabled for abuse and must stop working within a minute.
Out of scope for the first sketch
Click analytics · Custom vanity aliases · User accounts and link editing
Draw your design
Rough math and notes
SYSTEM DESIGN SKETCHBOOK / FOLLOW-UPS
Design a URL shortener
Finish your first sketch before answering these. Cross out freely.
- One alias suddenly gets 100× more traffic. Which part of your drawing takes the load?
- A link needs to be disabled immediately. What happens if a cache already has the redirect?
- How would you generate aliases without accidentally reusing one? What changes if the generator is distributed?
- Product now wants click counts per link. Where do you record a click without slowing the redirect?
Compare afterwards: worked approaches and reading at sketchbook /questions/url-shortener/review