Design a service that turns long URLs into short links, redirects on access, and reports click counts.
How to approach it
Turn the open-ended prompt into a concrete contract. Separate functional requirements (what the system does) from non-functional ones (latency, availability, consistency, scale), and state non-goals so you do not overbuild. Ask one or two clarifying questions that actually change the design — read/write ratio, scale, and consistency needs are usually the highest-leverage.
Functional requirements
- Create a short code for a long URL
- Redirect short code → original URL
- Optional custom alias
- Report click counts
Non-functional requirements
- Redirect p99 < 50ms
- 99.99% read availability
- Reads ≫ writes
- Links are effectively permanent
Out of scope
- Editing the destination after creation
- A full web-analytics suite
Tip
First clarifying question — What read:write ratio and link lifetime should we design for?