A modern, full-stack URL shortening application built with React and Node.js. Transform long URLs into short, shareable links with analytics, QR code generation, and user authentication.
- π URL Shortening: Convert long URLs into short, manageable links
- π Analytics Dashboard: Track clicks, views, and detailed analytics for your links
- π± QR Code Generation: Automatically generate QR codes for easy sharing
- π User Authentication: Secure authentication with JWT tokens
- π OAuth Integration: Sign in with Google, GitHub, or Apple
- π¨ Modern UI: Beautiful, responsive interface built with React and Tailwind CSS
- π Dark Mode: Toggle between light and dark themes
- π Link Management: View, edit, and delete your shortened URLs
- β‘ Fast & Secure: Built with performance and security best practices
- π± Mobile Responsive: Works seamlessly on all devices
- React 19 - UI library
- React Router DOM - Routing
- Vite - Build tool
- Tailwind CSS - Styling
- Framer Motion - Animations
- Axios - HTTP client
- React Toastify - Notifications
- QRCode React - QR code generation
- Chart.js / Recharts - Analytics visualization
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM
- JWT - Authentication
- Bcrypt - Password hashing
- Nanoid - Unique ID generation
- QRCode - QR code generation
- Helmet - Security headers
- Express Rate Limit - Rate limiting
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- npm or yarn
- MongoDB (local or cloud instance like MongoDB Atlas)
git clone <your-repository-url>
cd Minilinkcd Backend
npm installCreate a .env file in the Backend directory:
# Server Configuration
PORT=3000
NODE_ENV=development
APP_URL=http://localhost:3000
FRONTEND_URL=http://localhost:5173
# Database
MONGODB_URI=mongodb://localhost:27017/minilink
# Or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/minilink
# JWT
JWT_SECRET=your-super-secret-jwt-key-at-least-32-characters-long
# OAuth - Google (Optional)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_REDIRECT_URI=http://localhost:3000/api/oauth/google/callback
# OAuth - GitHub (Optional)
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GITHUB_REDIRECT_URI=http://localhost:3000/api/oauth/github/callback
# CORS (Optional, defaults to FRONTEND_URL)
CORS_ORIGIN=http://localhost:5173cd Frontend
npm installCreate a .env file in the Frontend directory:
VITE_API_URL=http://localhost:3000/api
VITE_SHORT_BASE_URL=http://localhost:3000Backend:
cd Backend
npm run devThe backend server will start on http://localhost:3000
Frontend:
cd Frontend
npm run devThe frontend will start on http://localhost:5173
Frontend:
cd Frontend
npm run build
npm run previewBackend:
cd Backend
npm startMinilink/
βββ Backend/
β βββ src/
β β βββ config/ # Configuration files
β β βββ controller/ # Request handlers
β β βββ middleware/ # Custom middleware
β β βββ model/ # Database models
β β βββ routes/ # API routes
β β βββ services/ # Business logic
β β βββ scripts/ # Utility scripts
β β βββ utils/ # Helper functions
β βββ app.js # Express app entry point
β βββ package.json
β
βββ Frontend/
β βββ src/
β β βββ components/ # React components
β β β βββ auth/ # Authentication components
β β β βββ common/ # Reusable UI components
β β β βββ features/ # Feature components
β β β βββ layout/ # Layout components
β β β βββ sections/ # Page sections
β β βββ context/ # React Context providers
β β βββ hooks/ # Custom React hooks
β β βββ pages/ # Page components
β β βββ routes/ # Route configuration
β β βββ services/ # API service layer
β β βββ styles/ # Global styles
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
β βββ package.json
β
βββ README.md
POST /api/auth/register- Register a new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout userGET /api/auth/profile- Get user profilePOST /api/auth/change-password- Change password
GET /api/oauth/google/url- Get Google OAuth URLGET /api/oauth/github/url- Get GitHub OAuth URLGET /api/oauth/apple/url- Get Apple OAuth URL
POST /api/urls- Create a new short URLGET /api/urls- Get user's URLsGET /api/urls/:id- Get specific URL detailsPUT /api/urls/:id- Update URLDELETE /api/urls/:id- Delete URLGET /api/urls/:id/analytics- Get URL analyticsGET /api/urls/:id/qrcode- Get QR code for URLGET /api/urls/stats/dashboard- Get dashboard statistics
GET /r/:shortId- Redirect to original URL
- Helmet.js - Sets security HTTP headers
- CORS - Cross-Origin Resource Sharing configuration
- Rate Limiting - Prevents abuse with request rate limiting
- Input Validation - Express Validator for request validation
- MongoDB Sanitization - Prevents NoSQL injection attacks
- JWT Authentication - Secure token-based authentication
- Bcrypt Password Hashing - Secure password storage
- HPP - HTTP Parameter Pollution protection
- Sign up or log in to your account
- Enter your long URL in the input field
- Click "Create Short Link"
- Copy the generated short URL
- Share it anywhere!
- Go to your dashboard
- Click on any link to view detailed analytics
- View click statistics, referrers, devices, and more
- QR codes are automatically generated for all shortened URLs
- Download QR codes directly from the dashboard
- Share QR codes for easy mobile access
# Backend tests (if available)
cd Backend
npm test
# Frontend tests (if available)
cd Frontend
npm testThe Backend/src/scripts/ directory contains utility scripts:
fix-shortid-index.js- Fix database index issuescleanup-null-shortids.js- Clean up invalid database entries
Run scripts with:
cd Backend
node src/scripts/script-name.jsMONGODB_URI- MongoDB connection stringJWT_SECRET- Secret key for JWT tokens (min 32 characters)
PORT- Server port (default: 3000)NODE_ENV- Environment (development/production)APP_URL- Backend base URLFRONTEND_URL- Frontend base URL- OAuth credentials (Google, GitHub, Apple)
ISC License
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For support, email support@minilink.com or create an issue in the repository.
- Built with React and Node.js
- UI components styled with Tailwind CSS
- Icons provided by Lucide React
Made with β€οΈ by the MiniLink Team