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:
- List the key non-functional requirements (eg low latency, scalability, reliability, etc.)...
Capacity Estimation
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandiwidth, and any relevant QPS calculations...
API Design
it will include a get url from endpoint the accepts the url from the client
this endpoint would be a webhook that streams the response live (this is to curb latency )
and a json reponse returning the shortened URL
High-Level Design
the overall system would be like a webhook provider that immediately streams the variant of the initially long url to its shortened form the data base will contain a list of strings that can serve as potential urls , storage will be slim , since the database would mark which combination of string that has not been used to form a URL
Database Design
we will be using an SQL database to track which string combination is in use ,
Detailed Component Design
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
the first component the get url endpoint would receive the url (that is to be shortened) and travel to the service route, make a request to the server on the available stringcombinations(shortened url) that recently expired and is available for use which will be cached instantly the string combo is expired
the webhook streams the new short url live to resolve redirect latency issues