Red - a color's name, or so it seems. Though it is not. Red is a URL shortener but it wasn't born as one. It was born as a URL Redirector (hence the name) for the links that I already had.
If you have been on Twitter (now X) or LinkedIn, you have probably gone through those t.co and linkd.in shortened URLs. Not just that, these kind of URLs are there in almost every other promotional message you get on your social media, emails and SMS messages. So really, why build another one?
Broken Links
Before there was Red, there was Chamber. That software, when launched contained links that began with https://r.techrail.in. Not just that, I had also sent the links to friends and family and even had sprinkled them on Social Media posts and status message.
As it happens, I was using another shortener service which helped me shorten some URLs with slug customization. I loved it till the day it was functioning.
When it stopped, I started getting DMs from strangers on the internet and friends about seeing a "service suspended" error. Questions about whether Chamber was alive, or I had taken it down started being asked. That's definitely not what I wanted.
Need - The mother of Invention
I could have looked for another service which provided similar service. But it would have taken lesser time to whip out a single-file program which rescued from the problem fast enough. So that's what I did. I wrote a main.go containing a map of my old slugs to the target links, a route and a handler function, cross-compiled it for the server's architecture, uploaded it to the server, configured my reverse proxy and the problem was solved for the immediate need - that people could visit the pages those links intended to take them to.
It was almost this much powering the entire app:
func redirectHandler(w http.ResponseWriter, r *http.Request) {
slug := r.URL.Path[1:] // Extract slug
targetURL, exists := linkMap[slug]
if !exists {
http.NotFound(w, r)
return
}
// The variable targetURL holds the destination
http.Redirect(w, r, targetURL, http.StatusFound)
}
The Human Tendency
Even before 24 hours passed by, I felt the need to have another link. Added to the map, recompiled, sent to server and relaunched. A couple more of this repetition and I was tired of the ritual.
In an hour, I added a database, wrote some queries and then creating a new link became a matter of INSERT INTO short_links VALUES(... against the database. But now I wanted to make it even easier. LLMs to the rescue, I created a static page where I could drop a long link, click a button and get a link.
Then I wanted custom slugs. Then I wanted HTTP redirects. Before long, my mind had a list of features that I wanted. But did not want to pay a lot for all the things (which other services were asking).
The Discord Community
Having discussed with dozens of people over at the Discord community for Techrail, I had realised one thing - different people wanted different features, even out of something as simple as a URL redirector (shortener) and everyone thought their needs are "obvious".
This gave birth to the idea of select your own features pricing model that we have featured on the front page. And being the very first user or what I was building, I wanted features to be free and figured that others would also love to have a pricing plan like that. And the feedback I received from the community, added to my own requirements gave birth to the entire idea of Red.
I hope you would love using Red as much as I have enjoyed hand-crafting it. I sincerely wish you would use all the features as much as I have obsessed over perfecting them.
What would you have done?
What would you have done if this happened with you? Let us know over at the Discord discussion!
Join Discord Server Continue Discussion!