A full-stack URL shortener built with the MERN stack. Paste any long URL and get a clean short link instantly, with click tracking included.
- 🔗 Shorten any long URL instantly
- 📊 Track click counts per link
- 🕒 Recent links dashboard
- 🐳 Dockerized backend + MongoDB
- Frontend: React, Vite
- Backend: Node.js, Express
- Database: MongoDB, Mongoose
- DevOps: Docker, Docker Compose
- Node.js v20+
- Docker Desktop
git clone https://github.com/Akshita0502/snip.dev.git
cd snip.devbackend/.env
MONGO_URL=mongodb://mongo:27017/urlshortener
BASE_URL=http://localhost:5000
PORT=5000
frontend/.env
VITE_API_URL=http://localhost:5000
docker-compose up --buildcd frontend
npm install
npm run dev- Frontend: http://localhost:5173
- Backend: http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| GET | / | Health check |
| POST | /shorten | Shorten a URL |
| GET | /r/:code | Redirect to original URL |
| GET | /stats/:code | Get click stats |
| GET | /all | Get all recent URLs |
snip.dev/
├── backend/
│ ├── server.js
│ ├── package.json
│ ├── Dockerfile
│ └── .env
├── frontend/
│ ├── src/
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── index.html
│ ├── package.json
│ ├── vite.config.js
│ └── .env
└── docker-compose.yml