URL-mini is a modern URL shortening service that allows users to create shortened links, track their usage statistics, and manage their URLs through a user-friendly dashboard.
- URL Shortening: Create short, easy-to-share URLs from long links
- User Authentication: Secure user registration and login system
- User Dashboard: Manage and track all your shortened URLs
- Analytics: View visit history and usage statistics for your URLs
- Responsive Design: Works seamlessly on desktop and mobile devices
- Backend: Node.js, Express.js
- Frontend: EJS templates, Bootstrap
- Database: MongoDB with Mongoose
- Authentication: JWT-based auth with HTTP-only cookies
- Error Handling: Custom error handling middleware
- Node.js (v14 or higher)
- MongoDB instance (local or MongoDB Atlas)
-
Clone the repository:
git clone https://github.com/yourusername/URL-mini.git cd URL-mini -
Install dependencies:
npm install -
Create a
.envfile in the root directory with the following variables:PORT=3000 MONGODB_URI=your_mongodb_connection_string SECRET_KEY=your_jwt_secret_key NODE_ENV=development -
Start the development server:
npm run dev -
Visit
http://localhost:3000to use the application
- GET / - Home page
- GET /url/:shortId - Redirect to the original URL
- POST /url - Create a new short URL (authenticated)
- DELETE /url/:id - Delete a URL (authenticated)
- GET /user/signin - Login page
- GET /user/signup - Registration page
- POST /user/signin - Login action
- POST /user/signup - Registration action
- GET /user/signout - Logout (authenticated)
- GET /home/dashboard - User dashboard (authenticated)
URL-mini/
├── config/ # Application configuration
├── public/ # Static assets
├── src/
│ ├── controller/ # Request handlers
│ ├── middleware/ # Custom middleware
│ ├── model/ # Database models
│ ├── routes/ # API routes
│ └── views/ # EJS templates
├── utils/ # Utility functions
├── app.js # Express application
└── server.js # Server entry point
This project is licensed under the MIT License - see the LICENSE file for details.
- nanoid - URL ID generation
- Express.js - Web framework
- Mongoose - MongoDB ODM
- Bootstrap - Frontend framework