link shortener

link shortener created using react and nodejs.

Google announced it was turning down support for their link shortener, so it was time to try and build my own link shortener. They all work in a similar way, a shorter alias is created for a (typically) longer URL and the user is redirected upon hitting the alias.

In my implementation, upon arriving at a shortened link, users would be presented with a 5 second timer along with some promoted content, before continuing to the destination link. I wanted to use this promotional space to promote my other projects, rather than Adsense and friends since their ads are generally ugly.

This link shortener is currently in use for the links on my resources page.

SEE EXAMPLE
Technical Details
  • Links were stored as key-value pairs, where the key would be the atomic counter of the number of links and the value would be the link itself.
  • Used a bijective function (to avoid collisions compared to using a hashing function) to map the numeric ID to an alphanumeric ID of length 4.
  • The original numeric ID was obtained by putting the alphanumeric id into the inverse function, and if this numeric ID existed as a key in datastore then the shortlink was valid.