Requirements
Functional Requirements:
- Create a short URL for a given long URL.
- Return the long URL associated with a given short URL.
Non-Functional Requirements:
- Should scale to map multiple short URLs to long URLs
- Low redirect latency
- High availability of this
- Let's say there are 10 million users -> 3 URLs a day, 30 million URLs a day, each URL is ~100 bytes, so that's like 3 billion or 3 GB a day
API Design
GET / -> This should redirect the user to the long URL
POST /longUrl?url=
High-Level Design
Hash URL -> check if it exists
Detailed Component Design
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.