1.
Design a URL Shortener similar to Bitly
Medium
Completed
45 min
FAANG
Problem Statement
This section contains the problem statement.
Design a scalable URL shortening service similar to Bitly. Convert long URLs into short aliases and handle massive traffic with high availability.
Clarifications
This section contains any clarifications related to the problem.
What is System Design?
System design defines architecture, components, and data flow of a system.
Why is System Design important?
It helps build scalable, efficient, and maintainable systems.
Functional Requirements
This section contains the functional requirements of the problem.
- Shorten a given long URL to a unique short URL.
- Redirect users from the short URL to the original long URL.
- Handle high read and write traffic efficiently.
- Provide analytics on URL usage (click counts).
Non-Functional Requirements
This section contains the non-functional requirements of the problem.
- Short URLs should be compact (6–8 characters).
- System must handle high read-to-write ratio (100:1).
- Redirection latency should be <100ms.
- System should be highly available and fault-tolerant.
- Avoid collisions in short URL generation.
- Prevent abuse (spam/malicious URLs).
Capacity Requirements
This section contains the capacity requirements of the problem.
| Metrics | Value | Note |
|---|---|---|
Daily Active Users | 300,000,000 | Peak traffic during business hours |
Read/Write Ratio | 100:1 | Heavily read-oriented system |
URLs Created/Day | 10,000,000 | ~116 URLs/sec |
Redirects/Day | 1,000,000,000 | ~11,500/sec |
API Contracts
This section contains the API contracts of the problem.
Get URL
Fetch original URL using short ID
1curl -X GET "https://api.com/api/v1/url/abc123"
Create Short URL
Create a shortened URL with optional alias and expiry
1curl -X POST "https://api.com/api/v1/shorten" \2 -H "Content-Type: application/json" \3 -d '{4 "url": "https://example.com/long-url",5 "custom_alias": "my-link",6 "expires_at": "2026-12-31T23:59:59Z"7 }'
Update URL
Update full URL configuration
1curl -X PUT "https://api.com/api/v1/url/abc123" \2 -H "Content-Type: application/json" \3 -d '{4 "url": "https://updated.com",5 "expires_at": "2027-01-01T00:00:00Z"6 }'
Partially Update URL
Update specific fields (like expiry)
1curl -X PATCH "https://api.com/api/v1/url/abc123" \2 -H "Content-Type: application/json" \3 -d '{4 "expires_at": "2027-06-01T00:00:00Z"5 }'
Delete URL
Delete a shortened URL permanently
1curl -X DELETE "https://api.com/api/v1/url/abc123"
Get URL Analytics
Fetch click analytics for a short URL
1curl -X GET "https://api.com/api/v1/url/abc123/analytics"
List User URLs
Fetch all URLs created by the user (paginated)
1curl -X GET "https://api.com/api/v1/user/urls?page=1&limit=10"
Follow-up & Extensions
This section contains the follow-up questions and extensions of the problem.
What is System Design?
System design defines architecture, components, and data flow of a system.
Why is System Design important?
It helps build scalable, efficient, and maintainable systems.
Loading Drawpad...