Short URL is a simple and efficient URL shortener built using Next.js and MySQL. This project is part of my portfolio, showcasing my skills in full-stack development.
Demo video link here: video link
- Shorten long URLs into concise, easy-to-share links.
- Track the number of times a shortened URL has been accessed.
- Manage URLs with a simple and intuitive interface.
- Next.js: A React framework for building fast, user-friendly web applications.
- MySQL: A relational database management system for storing URLs and their corresponding short codes.
- Prisma: An ORM for database migrations and queries.
- Node.js: JavaScript runtime for the server-side logic.
To run this project locally, follow the steps below:
- Node.js (v14.x or later)
- MySQL (v5.x or later)
- Git
-
Clone the repository:
git clone https://github.com/Soumajit2004/short-url.git cd short-url
-
Install dependencies:
npm install
-
Set up the database:
-
Create a MySQL database named
short_url
. -
Push the Prisma schema to your database:
npx prisma db push
-
Generate the Prisma client:
npx prisma generate
-
-
Configure environment variables:
Create a
.env.local
file in the root directory and add the following environment variables:DATABASE_URL="mysql://root:password@localhost:3307/database" NEXTAUTH_URL=http://localhost:3000/ NEXTAUTH_SECRET="REQUIRED" GITHUB_ID="CREATE A GITHUB OAUTH APP" GITHUB_SECRET="CREATE A GITHUB OAUTH APP"
-
Run the development server:
npm run dev
The application will be running on http://localhost:3000.
Once the server is running, you can shorten URLs by navigating to the homepage, entering a long URL, and clicking " Shorten." The shortened URL will be generated, which you can then share or track its usage.
For deployment, you can use services like Vercel, Netlify, or any cloud provider that supports Next.js applications. Make sure to configure the environment variables on the deployment platform as described above.
For any inquiries or issues, please contact me through GitHub.