Requirements
Functional Requirements:
- Create a short URL for a given long URL.
- Return the long URL associated with a given short URL.
Non-Functional Requirements:
- List the key non-functional requirements (eg low latency, scalability, reliability, etc.)...
API Design
post request for user login:/signin and post request for user registration : /signup, post request to send a server the long url to be shorten:/generateUrl. get request to get all the urls that a client has made:/getUrls
High-Level Design
there will be a frontend which the client will be using. The server will be responsible for getting the url to be shortened and add them to a queue or stream (redis stream will do). also it updates on the database. There will also be a cache so that there are no extra read for frequently needed data.
Detailed Component Design
there are three main components in the design, the first one is the server, its responsible for adding the url to the queue and updating the db. the second is the redis stream where all the urls will be pused. the third are the workers which will produce the short urls and then update it to the database in bulk.