System design interview question
Design a URL Shortener (e.g., bit.ly)
Design a URL shortening service that converts long URLs into short, unique links.
Functional Requirements:
- Users can submit a long URL and receive a short URL.
- Visiting the short URL redirects the user to the original long URL.
- Short links expire after 30 days by default.
Non-Functional Requirements:
- High availability: the redirect service must have 99.9% uptime.
- Low latency: redirects should complete in < 100 ms.
- Scale: 100 M URLs created per day, 10 B redirects per day.
Requirements
- Shorten a URL and return a unique short code.
- Redirect short URLs to original long URLs.
- Handle link expiration.
Practice this question step by step with an AI interviewer that reviews your requirements, your architecture and your trade-offs, and scores the design.