List functional requirements for the system (Ask the chat bot for hints if stuck.)..
functional requirements for a url shortner are
1) it should be able to shorten the url
2) It should store which url is shortned and its original url
3) when it is hit original url should be returned and user sent to that url
List non-functional requirements for the system...
Non finctional requirements should be that system should always be avalible for people to access we can use good cloud platofrm services like aws so that it is always accessible
This should be accessible to everyone at a good speed for which we can use cdn
it should be scalable It should have enough resources to run if it has multiple users accessing it it should crash fot that we can use a good server with decent configurations
Estimate the scale of the system you are going to design...
The system i am trying to build should be able to handle at leat 10k requests per minute without failing
Define what APIs are expected from the system...
Tiny url should have two apis as main :-
1) shortenUrl :- this api will take the url in input have a crypto function which will hash the url for a length of 10 since crypto will have range of 0-9, a-z , A-Z i wont have to worry about them being unique for a long time because if a lot of combunations to pick from. also each link generated will have a ttl of 7 days. after shorten url created a url it will be stored in db along with original url and data at which created and date at which it expires.
2) checkUrl:- this will be responsoble when a url is hit it checks for the tiny url quiery in db and redirects it to the original url
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
In database it will have a primary key , unique url generated by me , mapping og thr original url along with a date at which url is created and an expirey date for the url.
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...
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...
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?