Interview Questions/System Design/Design a URL Shortener (TinyURL)
AdvancedSystem-Design
45 min

Design a URL Shortener (TinyURL)

System DesignDatabasesCachingNetworkingSecurity
Advertisement
Interview Question

Design a globally available URL shortener like TinyURL/Bitly. Cover API design, key generation, storage, redirects, analytics, abuse prevention, and scalability.

Key Points to Cover
  • API: create/resolve endpoints, rate limits, auth for premium features
  • Key generation: base62 IDs, collision avoidance, snowflake/KSUID, custom aliases
  • Storage: KV store (hot) + relational/log for analytics; TTL/archival
  • Performance: CDN edge redirects, caching, read-heavy optimization
  • Reliability: multi-region replication, eventual consistency trade-offs
  • Abuse: spam/phishing detection, domain allow/deny lists, quotas
  • Analytics: click tracking, unique visitors, geo/UA aggregation
Evaluation Rubric
Clear API and key/ID strategy25% weight
Efficient storage and caching plan25% weight
Global scale, replication, and latency25% weight
Abuse prevention and analytics25% weight
Hints
  • 💡Consider read-path at CDN edge and write-path in regions.
Potential Follow-up Questions
  • How do you handle custom domains?
  • How would you prevent hash enumeration?
Advertisement