Shortly - URL Shortener
A URL shortener app that shortens longer URLs to shareable concise links.

Overview
The challenge
Users should be able to:
- View the optimal layout for the site depending on their device's screen size.
- Shorten any valid URL.
- See a list of their shortened links, even after refreshing the browser.
- Copy the shortened link to their clipboard in a single click.
- Receive an error message when the
form
is submitted if:- The
input
field is empty. - The submitted URL has already been shortened.
- The submitted URL is a previously generated shortened link.
- The
My process
Built with
- Semantic JSX markup
- Flexbox
- CSS Grid
- Mobile-first workflow
- React - JS library
- Next.js - React framework
- TypeScript - JavaScript with syntax for types
- Tailwind CSS - CSS framework
- Shadcn UI - Open-source component library
- Radix UI - Accessible component primitives
- Spoo.me API - API for URL shortening
- pnpm - Fast, disk space efficient package manager
What I learned
This project enhanced my understanding of several key concepts, including:
- Ensuring type safety and improving code reliability through TypeScript.
- Leveraging Shadcn UI to create a reusable and maintainable component library.
- Utilizing the
cn
utility function to apply conditional classes efficiently in Tailwind CSS. - Implementing SVG icons as React components to enable dynamic property modifications, such as hover states.
- Employing the
localStorage
object to persist shortened URLs as key-value pairs in the browser.
Continued development
In future projects, I intend to focus on the following areas for improvement:
- Establishing a centralized constants directory to streamline content management and enhance project organization.
Useful resources
- Tailwind CSS GitHub Repository - This resource provided inspiration on integrating SVG icons as React components, enhancing interactivity.
- cn() - Every Tailwind Coder Needs It (clsx + twMerge) - This video by Wesley on the ByteGrad YouTube channel offered practical guidance on the
cn
utility function, combiningclsx
andtailwind-merge
for efficient class management.