URL Shortening:
URL Redirection:
Error Handling:
Availability:
Scalability:
Security:
Estimate the scale of the system you are going to design...
URL Shortening:
URL Redirection:
Define what APIs are expected from the system...
Success Response: {
data: {
url: "abc.ly/xu3isf1"
},
status: 200, //status code is be according to the API response
message: "success",
error: {}
}
Error Response: {
data: {},
status: 412, //status code is be according to the API response
message: "validation failed",
error: {
code: 412,
message: "URL is invalid format"
}
}
Tables:
The URL Shortening Service is designed as a scalable, high-performance, and fault-tolerant web system that allows users to generate, resolve, and track shortened URLs.
At a high level, the system follows a modular microservice-based architecture (or optionally monolithic for MVP), consisting of stateless services behind a load balancer, with persistent storage and a caching layer to optimize performance.
Generates a unique, collision-free short code for each long URL.
Redirect users from a short URL to the original long URL.
Tech Choices: