API to create short url.
API to redirect to the long url for the corresponding short url.
Delete short url after certain x time of unuse.
Spring boot microservice to host rest APIs
High speed no sql DB as there is not much need for RDMS concepts
Spring boot microservice to host rest APIs:
POST API to create short url accepts long url in the request body.
Then calculates a unique hash for the url and stores in DB and returns back the short url. Can make use of a cache to once stored to DB with key being short url or unique has of short url and value being long url
The DB contains fields like id, domain, short_url, long_url
The fetch API can make use cache to fetch the longurl and return 302 redirect on long url fetched, if not in cache will make DB call to fetch.