URL Shortener
A URL shortener with its own backend, MongoDB Atlas persistence, and one-click link copying.
- 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
- 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.
- 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.
- 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.