A full-stack URL shortener with analytics, user authentication, and device/geo targeting. Built with React (Vite) for the frontend and Node.js/Express/MongoDB for the backend.
- Shorten URLs with optional custom aliases
- User registration and login (session-based and API key)
- Password-protected links
- Expiry by date or click count
- Device and geo-targeting for links
- Analytics: click tracking, tags, and more
- Admin dashboard (WIP)
- Frontend: React, Vite, TailwindCSS, Axios
- Backend: Node.js, Express, MongoDB, Mongoose
- Authentication: express-session, connect-mongo, bcryptjs
- Node.js (v18+ recommended)
- MongoDB instance (local or cloud)
Create a .env file in the Backend/ directory with:
MONGO_URI=your_mongodb_connection_string
SECRET_KEY=your_session_secret
BASE_URL=https://short-en.onrender.com/
cd Backend
npm install
npm run devcd Frontend
npm install
npm run dev- POST
/auth/register - Body:
{ name, emailAddress, password } - Response:
{ success, message, data: { newUser } }
- POST
/auth/login - Body:
{ emailAddress, password } - Response:
{ success, message, data: { currentUser } }
- POST
/ - Body:
originalUrl(string, required)preferredText(string, optional)expiryDate(date, optional)expiryClicks(number, optional)
- Response:
{ success, message, data: { newLink } }
- GET
/ - Response:
{ success, message, data: { allLinks } }
- GET
/:shortLinkId - Response: Redirects to the original URL
originalUrl: Original URLshortLinkId: Unique short codepreferredText: Custom aliasexpiryDate: Expiry dateexpiryClicks: Max allowed clickstags: Array of tagsexpiryType: "never", "expiryClicks", or "expiryDate"password: (hashed) password for protected linksclickCount: Number of times accessedpasswordProtected: BooleangeoTargeting:{ enabled, locations }deviceTargeting:{ enabled, devices }shortLink: Virtual, full short URL
- Main form: Enter original URL and (optionally) preferred text
- Displays the generated short link
- (WIP) Admin dashboard and analytics
- Backend:
cd Backend && npm run dev - Frontend:
cd Frontend && npm run dev
MIT