Back to work

URL Shortener

A URL shortener with its own backend, MongoDB Atlas persistence, and one-click link copying.

Date
Dec 2025
Category
Product
Status
Live

Stack

  • Next.js
  • React
  • TypeScript
  • MongoDB
  • Mongoose

Problem

The Frontend Mentor challenge suggested using Clean URI, but the project required its own backend capable of resolving short links and keeping them.

Role

I implemented the frontend and backend in Next.js, the Mongoose model, and the validation shared through Zod.

Decisions

  1. An own backend instead of Clean URI.

    A route following the /r/123abc pattern queries the database, retrieves the associated original URL, and redirects to the destination instead of delegating shortening to an external service.

  2. Zod validation on frontend and backend.

    The same schema checks that the input is a valid URL before storing it and that the URL retrieved from the database is a real, well-formed address.

  3. MongoDB Atlas with Mongoose.

    The link model and persistence use Mongoose over MongoDB Atlas, taking advantage of the full-stack capabilities of Next.js.

Result

The service shortens and redirects links, keeps the list of short links after a reload, and lets people copy each result with one click.