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
  • reliability
  • high availability


API Design

POST: /create-url

GET: /{short-url}



High-Level Design

The client makes a request which will be routed through the CDN and the API gateway to the load balancer. The load balancer decides which shortner service instance the request is routed to. The shortner service will shorten the long url to a short url. If the url is already shortened and accessed frequentky, it can be accessed from the cache, else it will be stored in the database and will be fetched from there.



Detailed Component Design

The Load Balancer is responsible to route requests to servers as per weight/load on them.


The rate limiter is in place to avoid DDoS attacks