Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
// POST API endpoint for generating a short URL. It ingests a long URL, and on success, returns a small URL.
POST generateSmallUrl (longUrl: string): (smallUrl : string)
// GET API endpoint for getting a long URL from a short URL
// Takes in a small URL, and fetches the long URL from the database, and returns it.
GET getSmallUrl (smallUrl: string): (longUrl: string)
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.
It is a web app.
Written in HTML
The user opens the web-app in their browser.
They see an input box and a "Shorten" action button.
They enter their long URL.
The long URL is sent to the server.
The server:
The user sees the long URL in their browser
When a user navigates to the short url:
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...
SQL database
Access patterns:
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.