Linkify is a full-stack URL shortening app built with Node.js, Express, MongoDB, and EJS. It converts long URLs into short, shareable links with authentication and basic click analytics.
- 👉 Live App: https://linkify-8r5h.onrender.com
- 🔐 JWT-based authentication (login/signup)
- 🎯 Short URL generation (NanoID/ShortID)
- 🔁 Fast redirects (
/:shortId) - 📊 Basic click analytics (stores visit timestamps)
- 🧭 Simple EJS UI (home, login, signup)
- 🔒 Protected routes for authenticated users
- Backend: Node.js, Express
- Database: MongoDB, Mongoose
- Views: EJS
- Auth: JWT (stored in cookies)
- Utilities: cookie-parser, nanoid/shortid
2_1Short_Url/
├── controllers/
├── middlewares/
├── models/
├── routes/
├── service/
├── views/
├── connect.js
├── index.js
├── .env
├── package.json
└── package-lock.json
- Go to the project folder:
cd 2_1Short_Url- Install dependencies:
npm install- Create
.env(don’t commit it):
You can copy from .env.example and update the values.
MONGO_URI=mongodb://localhost:27017/shorturl
JWT_SECRET=your_super_secret_key
PORT=8001- Start MongoDB locally (if using local MongoDB):
net start MongoDB- Run the app:
npm run devOpen: http://localhost:8001
| Variable | Required | Description |
|---|---|---|
MONGO_URI |
✅ | MongoDB connection string (local or Atlas) |
JWT_SECRET |
✅ | Secret used to sign JWT tokens |
PORT |
❌ | Local port (Render provides PORT automatically) |
POST /user— SignupPOST /user/login— LoginPOST /url— Create short URL (protected)GET /:shortId— Redirect + store visit timestampGET /— HomepageGET /signup— Signup pageGET /login— Login page
-
Create a MongoDB Atlas cluster and copy the
mongodb+srv://...connection string. -
On Render → New Web Service:
- Root Directory:
2_1Short_Url - Build Command:
npm install - Start Command:
npm start
- Add environment variables on Render:
MONGO_URI= your Atlas connection stringJWT_SECRET= a strong secretNODE_ENV=production(recommended)
Note: don’t set PORT on Render — Render sets it automatically.
Built by Avinash.


