2024-04-09

Updated URL Shortener

Introducing Chela!


Lately, I've been interested in improving my URL shortener hosted at https://trkt.in. So I did!

I present.. Chela!

I named Chela off of the small claw on crabs because it's like the little claw compared to the big one. Ok, I admit the name is vague but I think it's cute.

I built Chela in Rust using Axum as a server framework. It runs off of a Postgres database. It's very simple by design and also very fast. Using curl, I get a response in around a millisecond typically.

In my previous iteration of this project, I rather lazily generated IDs by hashing the URLs and then taking the first four or so letters. It was ugly and at increasing risk of collision.

In this new iteration, I'm using Sqids to generate IDs. It's better, faster (I think), and it looks prettier.

For example,

These both link to the same website (my previous blog post), but one of them is a whole lot easier to remember.

Also, this new version supports the + feature from bit.ly, where if you put a plus sign at the end of a URL it will show you what it links to. Try it!

I made the Docker image for Chela as small as I could without going off the deep end. The Chela binary is around 5Mb, and the full Docker image is just about 14Mb not including the Postgres dependency.

If you're interested, feel free to check it out here: https://trkt.in/oz.