The 30 March 2019 Google has officially shut down all access to his Url shortener goo.gl. It was a sad news for me because I used it a LOT (more than 1k url shortened). I have then decided to make my own url shortener.
The first step was to find a short domain name that I could use to host my solution. I wanted it to be no longer than the original goo.gl (5 characters). Fortunately It was not a big deal and I've come up with: hat.lu.
The next step was to design the solution. I have decided to break it into 3 parts:
- The redirector (PHP): the service that listen on hat.lu:80/443 and perform redirection based on URL. (f.e hat.lu/x435E will redirect on facebook.com). The redirector query the database using the code (x435E in the example) and lookup for a redirection.
- The API (Python/Flask): the interface that listen on api.hat.lu:80/443 used by the frontend application to communicate. Used to CRUD users/links.
- The frontend (Angular): the application that listen on my.hat.lu:80/443 used by end customers to register account, add link, view analytics, etc...
The application run in a docker swarm cluster to allow load balancing and auto scaling based on ressources usage. (The more users used the applications, the more instance there is)
The whole solution source code is available at: https://github.com/hat-lu. PR are accepted with pleasure.
Like goo.gl, hat.lu can be used anonymously (without being authenticated) but therefore analytics won't be available. If the user want to create link anonymously and register later, the previously created links won't be lost! They can be linked to his account automatically if the user hasn't clear his browser cache.