A simple URL Shortener web application built using Node.js, Express, MongoDB, and EJS. It allows users to shorten long URLs and track visit history.
- ๐ Generate short URLs
- ๐ Track number of clicks
- ๐ Redirect to original URL
- ๐ View all shortened URLs in a table
- โก Fast and simple UI using EJS
- Backend: Node.js, Express.js
- Database: MongoDB
- Templating Engine: EJS
- Other: Mongoose, NanoID
URL_shortner/
โ
โโโ controllers/
โโโ models/
โโโ routes/
โโโ views/
โโโ connections/
โโโ index.js
โโโ package.json
git clone https://github.com/your-username/url-shortener.git
cd url-shortenernpm installMake sure MongoDB is running locally:
mongodb://localhost:27017/short-urlnode index.jshttp://localhost:5001/
| Method | Route | Description |
|---|---|---|
| POST | /url |
Create short URL |
| GET | /url/:shortId |
Redirect to original URL |
| GET | /url/analytics/:shortId |
Get analytics |
- Enter a long URL
- Click Generate
- Get a short URL
- Click short URL โ redirected
- Visit count increases
- Express routing & middleware
- MongoDB with Mongoose
- MVC structure
- Server-side rendering with EJS
- REST API design
- ๐ Copy to clipboard button
- ๐ Advanced analytics (graphs)
- ๐ User authentication
- ๐ Deploy to cloud (Render / Vercel / AWS)
- โ๏ธ React frontend
Feel free to fork this repo and improve it!
Garv Saxena