There are two categories of data we need to store
We will ignore analytics collection for now, and focus on the functional requirements, which are creation, editing, and reading of short URLs. As such we would need the following API routes
GET /api/:short_url
Purpose: Meant to get the target URL associated with a short URL. Expects short_url as path argument, and returns a HTTP Temporary Redirect.
Response: 302 target_url
PUT /api/:short_url
Purpose: Meant to update the short URL
Request body args:
Response: 200
PUT /api/shorten
Purpose: Meant to create a short URL
Request body args:
Response: 200, along with short_url
Each record will contain the following
We don't need to aggregate, or model complex relationships in this data, so we can use a read optimized no-sql database such as DynamoDB.
Our system consists of
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?