Design a URL shortening platform

Quick Overview

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

Company: Amazon

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

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.

Quick Answer: 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.

|Home/System Design/Amazon
Amazon logo
Amazon
Sep 6, 2025, 12:00 AM
hardSoftware EngineerOnsiteSystem Design
12
0

Design a Scalable URL Shortening Platform

Context

Build a Bitly-like URL shortener that maps long URLs to short codes and performs HTTP redirection reliably at global scale. Assume the service is read-heavy, stores billions of links, and must meet low latency and high availability requirements.

Requirements

  1. APIs
  • Define REST APIs for:
    • Create short link (with optional custom alias and TTL)
    • Expand short code to original URL (preview)
    • Delete/disable a short link
  1. Short Code Generation
  • Strategy: hashing and/or counter-based IDs
  • Base-N encoding (e.g., base62)
  • Collision handling
  • Support custom aliases
  • TTL/expiration behavior
  1. Data Model and Storage
  • Schema for links, users, and analytics
  • Storage for billions of links (trade-offs: SQL vs NoSQL, KV stores)
  • Indexing and sharding strategy
  1. Read-Heavy Architecture
  • Caches (edge and regional)
  • CDN and edge compute considerations
  • Redirect behavior (301/302/307) and caching semantics
  1. Rate Limiting and Abuse Prevention
  • Per-IP/account rate limiting
  • Malware/phishing detection, Safe Browsing integration
  • Blacklist/allowlist, link scanning
  1. Analytics
  • Click counts, uniques, geo, time-of-day
  • Real-time vs batch pipelines
  1. GDPR/Compliance
  • Data minimization, retention, encryption
  • Right-to-be-forgotten, data residency
  1. Capacity Plan
  • QPS estimates (create vs redirect)
  • Storage sizing (links and logs)
  1. Fault-Tolerant Deployment
  • Multi-AZ/region replication
  • Sharding, failover
  1. Consistency Trade-offs
  • Strong vs eventual consistency (creation, expansion, deletion)
  • Global uniqueness of custom aliases

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...