Skip to content

A simple URL shortener built with Next.js, MySQL, and Prisma. Features include URL shortening, click tracking, and an intuitive interface. Designed for efficient management and easy sharing of links.

Notifications You must be signed in to change notification settings

Soumajit2004/short-url

Repository files navigation

Short URL

GitHub

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.

Screenshots

Demo video link here: video link

Screenshot 1

Screenshot 2

Screenshot 3

Features

  • 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.

Technologies Used

  • 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.

Getting Started

To run this project locally, follow the steps below:

Prerequisites

  • Node.js (v14.x or later)
  • MySQL (v5.x or later)
  • Git

Installation

  1. Clone the repository:

    git clone https://github.com/Soumajit2004/short-url.git
    cd short-url
  2. Install dependencies:

    npm install
  3. 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
  4. 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"
  5. Run the development server:

    npm run dev

    The application will be running on http://localhost:3000.

Usage

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.

Deployment

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.

Contact

For any inquiries or issues, please contact me through GitHub.

About

A simple URL shortener built with Next.js, MySQL, and Prisma. Features include URL shortening, click tracking, and an intuitive interface. Designed for efficient management and easy sharing of links.

Topics

Resources

Stars

Watchers

Forks