Available on github: https://github.com/DandrewsDev/lnkd
Link shortening has been around for almost as long as lengthy URLs. There are a number of big names in the space offering both free and paid services for creating a short URL that redirects to a much longer one.
I recently went looking for options to make some custom named short URLs for a handful of projects I've been working on. For instance, in a recent blog post I discussed a dashboard of analytics for a CS:GO hub. https://dandrews.net/mmd/
In that article I link out to the dashboard. But that link is far too long to remember and I need to go and look it up every time I want to share it. After a few hours of looking through the most popular link shorteners both free and premium, I found that none really fit what I was looking for.
A number of these have very powerful suites of analytics. Telling you way more about who was using your link than I ever wanted. By using one of these links I'd basically be signing up everyone I gave it to, to have their data collected by some large tech company. I wanted more control of what data was, or more importantly wasn't collected using a simple link. So I turned to self hosted options. And there are a few popular ones out there. I tried out 2 of the highest rated ones I found, and both mostly did the job. They each have their own quirks for setup or usage but would have done everything I needed. But in the hours I spent working with these, in both setup and configuration I kept thinking it would almost be faster to make my own. Spoiler alert, it was not faster.
Enter LNKD or linked. A new open source URL shortener. Super simple to get setup in a self-hosted environment. Getting started is as easy as a single command given you already have docker up and running. Every running instance of LNKD has two modes, a totally open link shortener that creates randomly generated URLs. Ex: https://lnkds.me/Bl2IgRu1
And a second mode for logged-in users that allows the creation of named or vanity URLs. Ex: https://lnkds.me/git
In both instances the LNKD service will redirect users to the saved long URL. And both capture the exact same data about the user... none. The only analytics supported is a hit count, a running tally of how many times a link has been used.
While I won't go into every technical detail here (check it out on github if you're interested). I did want to mention a few pieces of info on the project and its construction. LNKD is API first, literally I built the API first. The front end does everything through the API. Which means it can be used by scripts, programs, build processes or any other tool which can be extended to use its API. And lastly, the frontend is built using Svelte. This was a totally new JS framework for me, and I learned a lot in the few days it took to get this project up and running. A lot of the projects I talk about on this blog use VueJS a framework I like very much. And it certainly would have been faster for me to have used Vue here. But I wanted to take the opportunity to learn something new. It was a lot of fun, and Im proud to see this project go live. It may never get 5% the traction or usage of the other projects out there but I'd still think it was worth the time even if just for my own personal projects.