A simple link shortener built using the Next.js framework, Next UI components, TypeScript, and SQLite.
This is my first attempt at creating a link shortener, done entirely without any external help. I acknowledge that my approach might not be perfect and could potentially have flaws, but it works!
- The user inputs a
URLthey want to shorten. ThisURLis validated against a regular expression to ensure it is in a correct format. - The application checks the database to see if a short link for this
URLalready exists. If it does, the existing short link is returned to the user. If not, a new entry is created in the database with the originalURLand the generated short code. - When someone visits the shortened link, the application queries the database for the original
URL. If found, the user is redirected to thatURL; if not, the user is notified that the code is invalid.
A public version is deployed on Render, which you can access here: ShortDeezLinks - Render
You can also self-host it on your local machines or any similar platform.
Feel free to contribute!