Skip to content
Back to projects

URL Shortener

Web Development · 2024

Project overview

Shortens long links and tracks click counts per link, backed by MongoDB with an Express and EJS front end.

A full-stack URL shortener in Node, Express and MongoDB. Paste a long link, get a short code back, and every shortened link is listed on the front page with the address it points at and how many times it has been followed. Turning the click counter into part of the main table rather than a separate analytics page is what makes it useful day to day.

The interesting decisions here are small ones. The short code is generated on the Mongoose model rather than assembled in the route, so the route stays four lines and the uniqueness logic lives with the data. Pages are rendered server-side with EJS, which means the whole thing works with JavaScript switched off. And a code that does not exist returns a real 404 instead of quietly redirecting somewhere the visitor did not ask for.