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

  1. A backend service hosted on DNS like short_url.com
  2. API limits
  3. Authentication - max shorten urls
  4. 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.
  5. 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