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/shorten
{ "longUrl": "https://www.example.com/some/very/long/url", "customAlias": "mycustomurl"}
respone {
{ "shortUrl": "https://short.ly/mycustomurl", "longUrl": "https://www.example.com/some/very/long/url"}
}
get api/shorten/{shprturl}
respone{longUrl": "https://www.example.com/some/very/long/url",
}
Get short url, send back a long url
In the high-level design, you focus on the main components of the system and how they interact with each other. Here’s an example:
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 Write Path Service is responsible for creating short URLs from long URLs. It handles the validation of incoming URLs, generates unique short URLs, and stores the mapping in the database.
POST /api/shorten{ "longUrl": "https://www.example.com/some/very/long/url"}{ "shortUrl": "https://short.ly/abc123"}