Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
We need 2 Api:-
1:- Create Api for generating a short url from the given url.
2:- Get Api for getting all short url's generated by the user.
So basically Client will come and type a url to make it short and then he will make request to server and from their it routes page will define the request method if it is create so a create url api will get triggered to convert a given url into a short url and send back a response to the client and it will also get stored in Database for future use.
There will be 2 table in Database one of user and another one UrlShortner user table will contain basic information of user and access token of user and UrlShortner table will contain userid as a foreign key and given url + generated short url column and count of no. of tims used a same url for generating a short url.
There will be two things frontend and backend from frontend there will be a url shortner page where user will add their url to make it short and then a server will get called based on the routes and midldeware to authenticate the user the api will get decided which to call and the function will get exectued according to condition which will be inside the service folder where all our business logic will be stored and then they make a query to store the short url corresponding to the given url in Database and the count too based on that if that url will come another time from any user so we will directly fetch from db and provide that short url to db without doing any expensive computation to short the url.