Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
POST /api/v1/shorten
Body : {"long_url" : "https://..." }
Response: { "short_code": "abc123", "short_url": "http://tinyurl.com/abc123" }
GET /api/v1/{short_url} Response: 301 Redirect to original long URL
url_shortner_app
relational database to store long_url with shorterned url as response from the application
shortern_url to be retrived from the db and redirected to long_url
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
url_shortner_app: we would work with fastapi which is having an two endpoints where we get long_url as POST and would return short_code and short_url as dict for response.
database: we will store the long_url and its corresponding short_url and short_code in the releavent db row and we would provide short_url as response to user.
short_url will be re-directed to open the website accurately.
since we need this service to be used by multiple people so we have to sacle this service without any issues and hence we add router into fastapi application.