A full-stack URL shortener with JWT auth, custom codes, QR generation, and 10 URLs/day limit.
tinyurl-clone/
├── server/ → Express + MongoDB backend
├── client/ → React frontend
└── package.json → Root runner
- Node.js v18+
- MongoDB (local or MongoDB Atlas)
# Install everything at once
npm install
npm run install-allcd server
cp .env.example .envEdit server/.env:
PORT=5000
MONGO_URI=mongodb://localhost:27017/tinyurl
JWT_SECRET=your_super_secret_key_here
BASE_URL=http://localhost:5000
CLIENT_URL=http://localhost:3000
For MongoDB Atlas, replace MONGO_URI with your Atlas connection string.
Option A – Run both together (recommended):
npm run devOption B – Run separately:
# Terminal 1 — Backend
npm run server
# Terminal 2 — Frontend
npm run client- Frontend → http://localhost:3000
- Backend API → http://localhost:5000
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/auth/register |
❌ | Register new user |
| POST | /api/auth/login |
❌ | Login + get JWT |
| GET | /api/auth/me |
✅ | Get current user |
| POST | /api/url/shorten |
✅ | Shorten a URL |
| GET | /api/url/my-urls |
✅ | Get all user URLs |
| DELETE | /api/url/:id |
✅ | Delete a URL |
| GET | /:shortCode |
❌ | Redirect to original |
- 🔐 JWT Authentication — Secure register/login
- 🔗 URL Shortening — 6-char random codes via nanoid
- ✏️ Custom Short Codes — Set your own alias (3–20 chars)
- 📊 10 URLs/Day Limit — Per user, resets at midnight
- 📱 QR Code Generation — Downloadable PNG per URL
- 📈 Click Tracking — Count visits per short URL
- 📋 Copy to Clipboard — One-click copy
Backend → Render.com
- Push to GitHub
- Create new Web Service on Render
- Set root directory to
server - Add all
.envvariables in Render dashboard - Change
BASE_URLto your Render URL
Frontend → Vercel
- Import GitHub repo on Vercel
- Set root directory to
client - Add env:
REACT_APP_API_URL=https://your-render-url.com - Update
client/src/api/index.jsbaseURL to useprocess.env.REACT_APP_API_URL
| Layer | Tech |
|---|---|
| Frontend | React 18, React Router v6 |
| Backend | Node.js, Express.js |
| Database | MongoDB + Mongoose |
| Auth | JWT + bcryptjs |
| URL gen | nanoid |
| QR Code | qrcode |
| Styling | Custom CSS (DM Mono + Syne fonts) |