Previous Problem
Next Problem
Design URL Shortner
1.
Design a URL Shortener similar to Bitly

Medium

The difficulty level of this problem.

Completed

Your current progress status for this problem.
45 min
Estimated time to complete this problem.

FAANG

This question is frequently asked in FAANG interviews.
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.
  1. Shorten a given long URL to a unique short URL.
  2. Redirect users from the short URL to the original long URL.
  3. Handle high read and write traffic efficiently.
  4. Provide analytics on URL usage (click counts).
Non-Functional Requirements
This section contains the non-functional requirements of the problem.
  1. Short URLs should be compact (6–8 characters).
  2. System must handle high read-to-write ratio (100:1).
  3. Redirection latency should be <100ms.
  4. System should be highly available and fault-tolerant.
  5. Avoid collisions in short URL generation.
  6. Prevent abuse (spam/malicious URLs).
Capacity Requirements
This section contains the capacity requirements of the problem.
MetricsValueNote
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...