-Map shortened URLs to full length URLs
-Generate shortened URLs from full length URLs
-Allow users to track the shortened URLs they have generated
-User authentication to access the shortening service
-user password encryption
-Key-value store of short URLs to long URLs
-Retrieve associated long URL in 500 ms or less
-Store frequently accessed URLs in Redis cache to significantly reduce retrieval time
-Hash collision detection for the generation of short URLs to prevent duplicates
-database sharding for high availability
-load balancing system for peak traffic
-10 million unique URLs
-1000 requests/second
-20000 users
Define what APIs are expected from the system...
-input shortened URL -> output redirection link to longer URL (return from cache or db)
-user signup (name, email, password)
-user sign-in (email, password)
-create shortened url: input long URL and create db entry (associated signed in user)
-delete shortened url entry (only user can delete their own)
Frequently accessed shortened URLs in Redis cache
MySQL db with:
-user info table
-table mapping of shortened url to longer url by which user, along with traffic volume
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...
Front-end
-user signup
-user login
-dashboard
-manage urls
-see traffic
-create shortened url
-delete shortened url
-log out
Server (API)
-routes as detailed in API specification
Backend
-Redis cache for urls accessed in the last 12 hours
-DB as described in db diagram
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Request from front-end -> API
API -> Redis cache or Backend
Redis cache or Backend -> API
API -> front-end
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...
Front-end
-NextJS
-component-based architecutre
API
-node.js/express
-password encryption
DB
-mySQL
-3 tables
Explain any trade offs you have made and why you made certain tech choices...
Chose MySQL as the data is structured
Chose NextJS as it is a popular and well-maintained front-end framework
Chose Node and express as they are popular and well-maintained server frameworks
Try to discuss as many failure scenarios/bottlenecks as possible.
-Out of short URLs
-Out of storage for users
-Too many requests at one time
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?
Have a rate limiter for the API/load balancer to handle traffic