Simple Short URL Service
I happened to buy a domain name that could be used for short URL’s and thought: why not, let’s give it a try!
A search for “URL shortener” on dev.to, quickly directed me down a rabbit hole, like how to build a URL shortener service at FAANG scale (for billions of users). I don’t need that, just something for myself. And thinking one step further, I don’t even need a URL shortener. Creating the links is something I can do manually to start with, the core is to have the redirects working in a fairly performant way on the public Internet without breaking the bank. Since my goal was to have personal short links, I don’t have to support trillions of links.
Then I found Gijo Varghese’s excellent Netlify URL Shortener. I copied the concept and created a new repo on GitHub with the following content:
_redirects 404.html index.html
I deployed the thing with Netlify and…done ✅
Using a _redirects file with Netlify means that they take care of the hard parts. The only thing I have to do is to add a new line to the _redirects file in my repo. It’s also case-sensitive, so I could automate this with an Alfred Workflow that generates a Base 62 hash and updates the _redirects file in the repository, but I’ll save that for some future rainy day.
Here is a link to this post: https://henriks.link/t4Xz