Re: [dev] running a shortlink provider

From: Spenser Truex <truex_AT_equwal.com>
Date: Thu, 25 May 2023 05:08:11 -0300

Highlight:

Link shorteners always go down due to non-funding and bloatware
backends. Let's have a suckless one that is cheap to run!

On 23/05/25 07:02AM, Marcel Plch wrote:
> On Thu, May 25, 2023 at 12:47:20AM -0300, Spenser Truex wrote:
> > Hello,
> >
> > My internet friends and I have been wanting a shortlinks provider. How
> > can I do this in a suckless way? I'd like to be able to host the
> > shortlinks provider and easily let my friends point their own domains at
> > my VPS.
> >
> > I used to just upload a HTML file with a redirect to the desired
> > location in my webserver root. This doesn't work for a shared service
> > though.
> >
> > There are a lot of bloated projects that I've found. Any suggestions?
> >
> >
> > --
> > CAEE B377 FC82 BAF9 102C D22F C5CE D003 1AA8 E281
> > Spenser Truex https://equwal.com
>
> 1) VPS
> 2) Pick favorite Web stack
> 3) Make a website that takes the specified URL, stores the URL and its
> hash as a key-value pair (possibly in a database if that's suckless
> enough for you, directory+file structure is probably okay as well.)
> 4) Store the hash value in base64
>
>
> I personally would go for Python/Django, I'm not sure how suckless that's
> considered (probably not at all) but I found Django to be about the
> least bloated fully functional web framework. Web is in a sad state so
> I'm sure Unix gods are gonna reward you even if you write a minimalistic
> web in Django.
>
> Django also uses sqlite by default as a database backend, so it's not even
> a glass cannon. It knows that unless you bother to set something up, you
> probably don't need something special.
>
>
> I'm sure this suggestion is going to be either extremely helpful or
> upsetting. Let me know what you picked. ^_^

If we are going with "write your own backend" I'll do it in Common Lisp
since I like it. It's even more lindy than C. I guess the suckless lisp
is LISP 1.5. I suppose C could make a decent backend too, although I'm
not really up to the task of doing it with C. That being said, it's a
lot of work for something that has been redone a million times already.

I did some more research and found hda.me's codebase. It uses nginx and
postgresql. I'm not sure I want to use all that, but if I could make a
backend that is compatible for the F-Droid app then that would be neat.
The feature of either making 3-character tiny links that disappear, or
longer links that last a long time is very smart.

I found a bloatware that lets you just choose whatever link you want,
but I don't think I'd want to let anyone use my domain to make vanity
links like mydomain.com/mydomains-owner-is-a-cunt

The hda.me owner said he stopped funding it because he needed multiple
VPSes and cloudflare service to avoid getting his data-holding VPS shut
down for malicious use of the link shortener. This is avoidable by just
using a decent VPS provider and doing routine full disk backups just
in case. My intended use case is for each person to use their own domain
to make their own links, not really as a public link shortener.
-- 
CAEE B377 FC82 BAF9 102C  D22F C5CE D003 1AA8 E281
Spenser Truex        https://equwal.com

Received on Thu May 25 2023 - 10:08:11 CEST

This archive was generated by hypermail 2.3.0 : Thu May 25 2023 - 10:12:08 CEST