backend for Node.js for async operations, clustering, easy to use
DB as PostgreSQL with high availability,
AWS EC2 for deployment select a nearest region where app need to run,
SQS for high frequancy data management,
ASG for auto scaling on high requests over time
Use cloud front for caching a value and preventing the same server request
Generate a random short URL for it
scale based on ASG around 2 lakh per instance, because we use redis for caching
Create a short URL where a random string is used with the original URL
At creation, check if the same record exists or not
get api by shorturl, and store key-value pair into Redis
connection for DB, handle errors for those APIs, and DB connection to prevent server closure
model with fields of URL(original),shortURL,expiration time,metadata
If analytics needs to add a field for device ID, device type
where metadata for URL details
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
user request on browser at that time, which gets a request, finds the requested URL, and updates the original URL as a request.
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?