Design a URL shortener (e.g. bit.ly)
Classic interview: encode billions of URLs, fast redirects, optional analytics — walk through requirements to storage to scaling.
~28 minDesign interview
Step 0 / 0
Interview script (outline)
- Clarify: custom aliases, expiry, analytics, private vs public links, edit/delete.
- Estimate: new URLs/day, redirect QPS, read:write ratio, storage per year.
- API: REST shape; 302 vs 301; idempotent create with optional idempotency key.
- Encoding: counter + base62 vs random + collision check; length vs namespace.
- Storage: PK, partitioning, replication for reads.
- Redirect path: edge → cache → DB; cache headers.
- Failure: cache miss storm, abuse, malware links.