ShortMe

Fast & Secure URL Shortener

ShortMe

Fast, simple, and secure URL shortening service built with Next.js. Create short, memorable links with user authentication and dashboard management.

2 stars0 forksUpdated last year

Tech Stack

Next.jsTypeScriptMySQLJWTTailwind CSS

ShortMe is a fast, simple, and secure URL shortening service built with Next.js. Create short, memorable links from long URLs with user authentication, analytics, and a modern dashboardβ€”all backed by MySQL for reliable data persistence.

✨ Key Features

πŸ”—

URL Shortening

Create short, memorable links from long URLs instantly

πŸ‘€

User Authentication

Secure registration and login system for link management

πŸ“Š

Dashboard

Manage all your shortened links in one centralized place

πŸ”

JWT Security

Secure session management with JWT token authentication

πŸ’Ύ

MySQL Database

Reliable data persistence and link history tracking

🎨

Modern UI

Built with Tailwind CSS for a sleek, responsive interface

⚑

Type-Safe

Full TypeScript support for reliability and better DX

πŸš€

Production Ready

Fast, scalable, and ready for deployment

πŸš€ Getting Started

πŸ“¦ Installation

1. Clone the repository:

git clone https://github.com/kibaofficial/shortme.git cd shortme

2. Install dependencies:

npm install

3. Set up database (.env):

NEXT_PUBLIC_HOSTNAME=http://localhost:3000
DEBUG=false
DB_HOST="localhost"
DB_USER="shortme"
DB_PASS="shortme"
DB_NAME="shortme"

4. Start development server:

npm run dev

Prerequisites

  • βœ“Node.js v16 or higher
  • βœ“MySQL or MariaDB
  • βœ“npm, yarn, pnpm, or bun

πŸ“– How to Use

1

Register/Login

Navigate to the authentication page and create your account

2

Access Dashboard

After login, you'll be redirected to your personal dashboard

3

Create Link

Enter a long URL and get a short code instantly

4

Share & Track

Use your shortened link: http://localhost:3000/ShortCodeHere

πŸ—οΈ Project Structure

shortme/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/              # API routes
β”‚   β”‚   β”‚   β”œβ”€β”€ create-short/ # Create shortened URL
β”‚   β”‚   β”‚   β”œβ”€β”€ delete-code/  # Delete link
β”‚   β”‚   β”‚   β”œβ”€β”€ login/        # User login
β”‚   β”‚   β”‚   β”œβ”€β”€ register/     # User registration
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ auth/             # Authentication page
β”‚   β”‚   β”œβ”€β”€ dashboard/        # User dashboard
β”‚   β”‚   └── [code]/           # Dynamic redirect route
β”‚   β”œβ”€β”€ components/           # React components
β”‚   β”‚   β”œβ”€β”€ auth/             # Auth components
β”‚   β”‚   β”œβ”€β”€ ui/               # UI components
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ lib/                  # Utilities & services
β”‚   β”‚   β”œβ”€β”€ api.ts
β”‚   β”‚   β”œβ”€β”€ DB.ts
β”‚   β”‚   β”œβ”€β”€ middleware.ts
β”‚   β”‚   └── ...
β”‚   └── utils/
β”‚       └── GenerateDB.sql
β”œβ”€β”€ public/                   # Static assets
β”œβ”€β”€ .env.example
β”œβ”€β”€ next.config.mjs
β”œβ”€β”€ tsconfig.json
└── tailwind.config.ts

🎯 Core Components

πŸ”—

URL Shortener Engine

Efficient algorithm for generating unique short codes and managing redirects

πŸ”

JWT Authentication

Secure token-based session management with expiration handling

πŸ“Š

Link Management

Dashboard for viewing, editing, and deleting shortened URLs

πŸ—„οΈ

MySQL Integration

Persistent storage with schema for users, links, and metadata

⚑

API Routes

RESTful endpoints for all shortening and auth operations

πŸ”„

Dynamic Routing

Instant redirects using Next.js dynamic routes with [code]

πŸ› οΈ Tech Stack

β–Έ Frontend

  • Next.js - React framework
  • TypeScript - Type safety
  • Tailwind CSS - Styling

β–Έ Backend & Database

  • Next.js API Routes
  • JWT Authentication
  • MySQL/MariaDB

πŸ“‘ API Endpoints

POST
/api/register

Register new user account

POST
/api/login

User login with credentials

POST
/api/create-short

Create a new shortened URL

GET
/api/[code]

Redirect to original URL

DELETE
/api/delete-code

Remove a shortened link

πŸ’Ύ Database Schema

ShortMe uses MySQL to store user accounts, shortened links, and metadata:

Users Table
  • β€’id (Primary Key)
  • β€’username
  • β€’email
  • β€’password (hashed)
  • β€’created_at
Links Table
  • β€’id (Primary Key)
  • β€’user_id (FK)
  • β€’original_url
  • β€’short_code
  • β€’created_at
  • β€’expires_at

🎯 Status

βœ… Completed Features

  • βœ“User registration & login
  • βœ“URL shortening engine
  • βœ“Dashboard for link management
  • βœ“JWT authentication
  • βœ“MySQL database integration
  • βœ“Redirect functionality
  • βœ“TypeScript support

πŸš€ Future Enhancements

  • β—‹Click analytics & statistics
  • β—‹Custom short codes
  • β—‹QR code generation
  • β—‹Link expiration dates
  • β—‹Password protection
  • β—‹API rate limiting
  • β—‹Social sharing metrics

πŸ“š Learn More

πŸ”—

Next.js Docs

Official Next.js documentation and guides

πŸ”’

JWT Auth

JSON Web Token authentication patterns

πŸ—„οΈ

MySQL Docs

Database design and optimization

✨

TypeScript

Type safety and advanced patterns

v1.0β€’MIT Licenseβ€’2 ⭐ on GitHub

"Made with ❀️ for efficient URL shortening and link management"