Share your repls and programming experiences

← Back to all posts
caiocampos (6)

A new URL shortener

Some days ago I created my account here on, my main idea was to check if the platform was good to recommend to a friend of mine who just started programming.
At first I searched for a good idea of something to do and I found this Repl (, but had problems with the that wasn't working very well.
So I had the idea of making a version that didn't depend on anything external, and this is the result.

I used TingoDB, so is easy to migrate do MongoDB (that's why I chose it).

Zavexeon (1158)

So I tried shortening the link to your shortener, but it only made the link longer. 1/10.

All jokes aside, pretty nifty program!

caiocampos (6)

@Zavexeon, I chose to generate a longer string than the original to have a better chance of not repeating, since I'm using random numbers to generate (and numbers are limited), you can use the alias to make a shorter link 😄

xXJohnDoeXx (2)

so yeah i can get to files with alias lol

amasad (3353)

Awesome! So the database is hosted in memory?

caiocampos (6)

@amasad, the way I implemented Shrtr the data is stored in files, but it keeps a cache in memory. But it can also be used with in memory storage, just change the setting in api/repository/abs-repository.js file.

If I understood the documentation correctly you will need to change to something like this:
const {ObjectID, Db} = require('tingodb')({memStore: true});

caiocampos (6)

I found some people were tried to create links without "http://" or "https://", it's kind of embarrassing but I had not tested this kkkk.
I changed the code to try to address the issues related to it.