Create short URL from a long URL (optional custom alias)
Redirect short code → original long URL
Optional: expiry/TTL, click analytics
High availability (~99.99%) — shared links must never break
Low redirect latency (<100ms p99)
Read-heavy: reads ≫ writes (~100:1)
Horizontal scalability of the stateless read path
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
Create short URL
POST /api/v1/urls Body: { "longUrl": "https://example.com/very/long/path" } Response: 201 { "shortUrl": "https://sho.rt/aB3xK9", "longUrl": "..." } Errors: 400 invalid URL, 409 custom alias taken
GET /{shortCode} Response: 302 Found → Location: https://example.com/very/long/path Errors: 404 unknown code, 410 expired
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.