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, bandwidth, and any relevant QPS calculations...
API Design
Shorter should have 2 endpoints for
shortenUrl(url) - returns shortened url to the user, and stores in DB - POST.
getUrl(shortUrl) GET - fetches url and redirects to the user.
High-Level Design
we have cdn for finding closes server,
load balancer for redirecting user to closes API
2 microservices shortner service and redirect service.
Shortner stores most recent ursl into redis and dynamo db.
for sake of latency we fetch newly created urls from redis cache.
Database Design
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...
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.