Requirements
Functional Requirements:
- Create a short URL for a given long URL.
- Return the long URL associated with a given short URL.
Non-Functional Requirements:
- low latency, scalability, reliability
API Design
- A backend service hosted on DNS like short_url.com
- API limits
- Authentication - max shorten urls
- Generate short url api - header authentication + payload - full_url, valid till - process and store the shorten url check for existing url then return already stored short url.
- API : short_url.com/shorten_url_string get the full url and do a redirect to it - include rate limits
High-Level Design
Need a DB distributed preferred like Yugabyte, backend service on node js express or Go service, Nginx reverse proxy for DNS, a frontend to do authentication and shorten url flow.
Detailed Component Design
Once shorten url is stored in DB, whenever some makes a call to short_url.com/shorten_url_string call goes to our backend server which checks if shorten_url_string is valid if yes get the full url from DB and redirect the link to full url