A web application that shortens long URLs into compact, easy-to-share links. This project includes user authentication, click tracking, and an admin portal for managing statistics and user roles.
- ✂️ URL shortening
- 🛠️ Custom short URL creation
- 📊 Click tracking for each shortened URL
- 🔐 User authentication and role management
- ⚙️ Admin portal for statistics and user management
- 🕒 3-day history retention for URL clicks
- 🗑️ Ability to clear history (for users and admins)
- 🧹 Admin capability to delete any entry
- Node.js
- Express.js
- MongoDB Atlas
- EJS (Embedded JavaScript templating)
- JavaScript
- CSS
- JWT for authentication
{
"dependencies": {
"cookie-parser": "^1.4.6",
"dotenv": "^16.4.5",
"ejs": "^3.1.10",
"express": "^4.19.2",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.3.0",
"nodemon": "^3.1.0",
"shortid": "^2.2.16",
"sweetalert": "^2.1.2"
}
}
- Clone the repository.
- Run
npm install
to install dependencies. - Set up your MongoDB Atlas cluster and add the connection string to your
.env
file. - Run
npm start
to start the server.
- Navigate to the homepage.
- Enter a long URL in the input field.
- Click "Shorten" to generate a short URL.
- Copy and share the shortened URL.
Access the admin portal to:
- View overall statistics.
- Manage user roles.
- View and delete individual URL entries.
- Clear history for all users.
The length of the shortened URL ID may vary depending on the domain being used. While we aim for 8-character IDs, the actual length might be different to ensure uniqueness across the system.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.