LinkInsights is a full-stack URL shortening and analytics platform that allows users to create shortened links, track clicks, and analyze link performance with detailed insights.
- User Authentication - Secure signup/login with Firebase
- URL Shortening - Generate shortened URLs with custom aliases
- Click Analytics - Track and analyze link performance
- Dashboard - Comprehensive analytics and insights
- Link Management - View, edit, and delete your shortened links
- Click Details - Detailed information about each click (device, location, referrer)
- Responsive Design - Works seamlessly on desktop and mobile
LinkInsights/
βββ frontend/ # React + Vite frontend application
β βββ src/
β βββ package.json
β βββ README.md # Frontend setup guide
βββ server/ # Node.js + Express backend server
β βββ src/
β βββ package.json
β βββ README.md # Server setup guide
βββ README.md # This file (overview)
Before you begin, ensure you have:
- Node.js v14+ installed (Download)
- npm or yarn package manager
- MongoDB database (local or MongoDB Atlas)
- Firebase project (Setup Guide)
- Cloudinary account for image uploads (Sign up)
git clone <repository-url>
cd LinkInsights- Navigate to server directory:
cd server- Install dependencies:
npm install- Create
.envfile with required variables:
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/linkinsights
JWT_SECRET=your_secret_key_here
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_PRIVATE_KEY=your_private_key
FIREBASE_CLIENT_EMAIL=your_email
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
FRONTEND_URL=http://localhost:5173- Start the server:
npm run devServer will run on http://localhost:5000
π Full Server Setup Guide β
- Open a new terminal and navigate to frontend:
cd ../frontend- Install dependencies:
npm install- Create
.env.localfile:
VITE_API_BASE_URL=http://localhost:5000
VITE_BASE_URL=http://localhost:5173
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain
VITE_FIREBASE_PROJECT_ID=your_firebase_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=your_firebase_messaging_sender_id
VITE_FIREBASE_APP_ID=your_firebase_app_id
VITE_MEASUREMENT_ID=your_firebase_measurement_id- Start the development server:
npm run devFrontend will run on http://localhost:5173
π Full Frontend Setup Guide β
Open your browser and navigate to http://localhost:5173
- Frontend Setup & Development - React + Vite configuration, environment variables, project structure
- Backend Setup & API - Express server, MongoDB, API endpoints, environment variables
- React 18
- Vite
- Redux Toolkit
- Tailwind CSS
- React Router
- Recharts (Charts)
- GSAP (Animations)
- Lucide React (Icons)
- Axios (HTTP)
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT Authentication
- Firebase Admin SDK
- Nodemailer
- Cloudinary
cd frontend
# Development
npm run dev # Start dev server with HMR
# Production
npm run build # Build for production
npm run preview # Preview production build locally
# Quality
npm run lint # Check code with ESLintcd server
# Development
npm run dev # Start with auto-restart (nodemon)
# Production
npm start # Start server in production mode- JWT Authentication - Secure token-based authentication
- Password Hashing - Bcrypt encryption for passwords
- CORS Protection - Configured CORS for secure API access
- Environment Variables - Sensitive data stored in
.envfiles - Firebase Security - Firebase Admin SDK for secure operations
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginPOST /api/auth/forgot-password- Password reset requestPOST /api/auth/reset-password- Reset password
POST /api/links/create- Create shortened URLGET /api/links/getMyLinks- Get user's linksDELETE /api/links/deleteLink/:id- Delete a linkGET /api/links/analytics- Get analytics data
GET /:shortCode- Redirect and track click
# Change port in server/.env or frontend vite.config.js- Ensure MongoDB is running
- Check connection string in
server/.env - Verify database user credentials
- Verify
FRONTEND_URLin server.envmatches your frontend URL - Check API base URL in frontend
.env.local
- Ensure Firebase project is created
- Check service account credentials
- Verify Firebase config keys in frontend
.env.local
- Enable 2-factor authentication on Gmail
- Generate App Password
- Use generated password as
EMAIL_PASSin.env
- Create MongoDB Atlas cluster
- Create database user with strong password
- Copy connection string from Atlas dashboard
- Replace
<username>,<password>, and<dbname>in the string
- Go to Firebase Console
- Create a new project
- Enable Authentication methods
- Download service account key for backend
- Copy Firebase config for frontend
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test thoroughly
- Commit:
git commit -am 'Add feature' - Push:
git push origin feature/your-feature - Submit a pull request
If you encounter any issues:
- Check the relevant README (Frontend or Server)
- Review the Troubleshooting section above
- Create an issue on GitHub with detailed description
- Include error messages and environment setup details
This project is licensed under the MIT License - see LICENSE file for details.
- Keep both frontend and server running during development
- Use
.envand.env.localfiles for configuration (never commit them) - Check browser console and server logs for errors
- Test API endpoints with Postman before troubleshooting frontend
- Keep dependencies updated:
npm update
Happy coding! π Build something amazing with LinkInsights.
