1. Create Short URL (Write Path)
POST /shorten
Request Body:
{
"long_url": "https://example.com/very/long/url",
"custom_alias": "optional_custom_code" // optional
}
Response:
{
"short_url": "https://short.ly/abc123"
}
Description:
2. GET /{shorten_URL}
Response:
{
"long_url": "https://example.com/very/long/url",
}
Description:
Overview:
Create short URLs from long URLs.
Redirect short URLs to the original URL.
URL SHORTENING for LONG URL:
Request Flow – Write Path (Short URL Creation)
Client sends POST /shorten request with a long URL.
Load Balancer distributes the request across stateless App Servers.
API Gateway handles routing, authentication, and rate limiting.
ID Generation Service generates a unique short code (Base62 encoding, or distributed ID like Snowflake).
Shortening Service:
Redirect SHORTENED URL:
Request Flow – Read PATH (Short URL READ)
Client sends GET /{}reqshort_URL}
Load Balancer distributes the request across stateless App Servers.
API Gateway handles routing, authentication, and rate limiting.
REDIRECT SERVICE looks for short_URL in Cache and if it is there it is returned, otherwise it is queried into database.
ZOOKEEPER Each Shortening request is given to zookper so even if there is concurrent reuest it is appendent inti a queue and then unique id can be assigned and they can be treated without difficulty.
High Availability: Load balancer + stateless app servers + DB replication.
Low Latency Redirects: CDN + Redis cache.
Horizontal Scalability: App servers, DB sharding, Redis cluster.
Viral Link Handling: CDN + replicated hot keys + async click updates.
Concurrency / Collision-Free IDs: Distributed ID generation + message Queue + DB constraints.
Cache Handling: