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.)...
API Design
When designing for a URL shortener, we reflect the actions of the client. For example, we are required to creae a POST method which creates the shortened URL and consists of the larger URL in the request body. Afterwards, it is incumbent to retrieve the shortened URL using a GET method. To optimize for low latency given this is a high traffic design, we'd cache any request by performing a GET search into the database to see if the short to long url mapping is already present. simutaneously, each time someone accesses the short URL, a redirect is issued by perfomring that same database search (or accessing the cache) to redirect to the long URL. If a long URL doens't exist, a 404 response is returned
High-Level Design
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
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.