1. High Availability (Major) — If the service goes down, millions of links break. Users can't access their saved URLs. The system must stay up even if servers fail.
2. Low Redirect Latency (Major) — When someone clicks a short URL, the redirect should happen in milliseconds. Nobody waits for a redirect.
3. Horizontal Scalability (Minor) — The system should handle traffic spikes (viral links) by adding more servers, not upgrading one machine.
4. Durability — Shortened URLs should never be lost once created. Data persistence is critical.
Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
Request : POST /shorten
{
"long-url" : "https://www.example.com/test/",
"alias" : "my-link"
}
Response:
{
"short_url":"https://short.com/157147",
"long_url":"https://www.example.com/test/",
"code":"157147",
"created_at" : "2026-06-12 10:34:34"
}
2.Redirect Url
GET /{short_code}
Response: 301 Redirect to the original long URL (or 302 if you want to track click analytics).
GET /{short_code}/stats
Response:
{ "short_code": "abc123", "total_clicks": 452, "created_at": "2024-01-15T10:30:00Z"}
custom_alias support is a great differentiator in interviewsDescribe 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.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.