Created url shortner APIs using Golang, Gin & Redis. It also returns the original long url if the short url is provided.
Frameworks/Libraries: Golang, Redis, Docker
Tools/Technologies: Gin, SHA256, Base58
The mapping between the original Url and the generated short Url is stored in Redis
Test files consist of unit and integration tests for the database and GenerateShortLink method
Hashing the long url + userId with SHA256. The userId is added to prevent providing same urls to different users in case they want to shorten the same link.
Derive a big integer number from the hash bytes generated during the hasing
Lastly apply Base58 on the derived big integer value and pick the first 8 characters
Dockerized the web app and uploaded the docker image to AWS platform
Time & Effort
The project took ~20 hours in total, within 5 days.