URL shorteners shorten your URLs. You have many many products in the market - bit.ly being the most popular. However, with a bit of help from amazing people who have built them, we can use our own URL shorteners. Again, nothing magical here - this was quite an old problem. People wanted to always mask their URL or make it easier for sharing.
Here are three open source and free URL shorteners that you can use today!
Host these URL shortening services on your own servers - you can set them up almost instantaneously, shorten URLs prefixed with your domain, keep track of link clicks, and also collect analytics about where your link clicks are coming from.
Shlink appears to be the more modern solution of the lot.
It has docker support, beautiful looking UI on ReactJS, and plays well with both Nginx and Apache. You can use REST APIs and even a CLI tool to create short URLs.
YOURLS has been there forever. It is a PHP based solution, is quite easy to setup and I have used that before.
YOURLS is also available in CPANEL, and can be setup in your shared hosting with all but a couple of clicks. It just works and keeps working efficiently.
[Polr]https://polrproject.org/ is another solution based on PHP.
It supports creating URLs through API requests and is easy to use.
What triggered me to write this gem of an article (yes, sarcasm) was seeing an instance of this age-old problem was being analysed.
Use AWS or Azure for 301/302 redirects? Quickly create a beautiful solution in your favourite programming language that does not buckle under pressure to show off beautiful charts? Shave-off milliseconds while doing URL redirection by writing everything in Assembly?
Let’s say I am a tech guy in a company and someone asks whether I can create this app in a day. This is my thought process -
- Search internet to check on what other people are doing to solve the same (or a similar) problem
- Search for the easiest solution that’s not a pain to implement or maintain. Also check whether I can use existing infrastructure and keep costs reasonable
- Get approvals for the stack/cost. Work with other teams to enable supporting infrastructure and develop/deploy solution
To think that I would have to develop this solution ground-up will be the last thing to cross my mind.
This world is beautiful and exciting, and also thankfully - not everyone thinks like me. And probably, I am doing way-too-boring ‘stuff’ to think better and be on the ‘cutting edge’.