Design a URL shortening platform
AmazonSoftware Engineer · OnsiteLast updated
This question evaluates competency in system design and distributed systems architecture, including API design, scalable short-code generation, data modeling and storage/sharding, caching and CDN strategies, consistency and fault-tolerance trade-offs, rate limiting and abuse prevention, analytics, compliance, and capacity planning.
Design a URL shortening platform that maps long URLs to short codes and supports redirection at scale. Define the API (create, expand, delete), code generation strategy (hashing, base-N encoding, collision handling), custom aliases, and TTL/expiration. Propose a data model and storage choices for billions of links, and a read-heavy architecture with caches and CDN. Describe rate limiting, abuse/fraud prevention, analytics (click counts, uniques, geo, time), and GDPR/compliance considerations. Provide a capacity plan (QPS, storage), a fault-tolerant deployment (replication, sharding), and consistency trade-offs.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.