Prerequisites
Before setting up MeetMates locally, ensure you have the following installed:- Node.js (v16 or higher recommended)
- npm (comes with Node.js) or yarn
- MongoDB (v6.15.0 or higher)
- Local installation, or
- MongoDB Atlas account (free tier available)
- Git for version control
- Google Cloud Console account (for OAuth)
Clone the Repository
First, clone the MeetMates repository:Backend Setup
1. Install Backend Dependencies
Navigate to the backend directory and install dependencies:2. Configure Environment Variables
Create a.env file in the backend/ directory:
3. Set Up MongoDB
Option A: Local MongoDB
If running MongoDB locally:Option B: MongoDB Atlas
- Create a free cluster at MongoDB Atlas
- Get your connection string
- Replace
MONGODB_URIin.envwith your Atlas connection string:
4. Set Up Google OAuth
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google+ API
- Go to Credentials → Create Credentials → OAuth 2.0 Client ID
- Configure the OAuth consent screen
- Add authorized JavaScript origins:
http://localhost:5173(for development)- Your production domain (if applicable)
- Copy the Client ID and add it to both frontend and backend
.envfiles
5. Start the Backend Server
http://localhost:3001. You should see:
Frontend Setup
1. Install Frontend Dependencies
Open a new terminal window and navigate to the frontend directory:2. Configure Environment Variables
Create a.env file in the frontend/ directory:
VITE_GOOGLE_CLIENT_ID matches the GOOGLE_CLIENT_ID in the backend .env.
3. Start the Frontend Development Server
http://localhost:5173. Open this URL in your browser.
Verify Installation
Check Backend Health
- Backend server logs show “MongoDB connected”
- Backend is accessible at
http://localhost:3001 - Test the API endpoint:
Check Frontend
- Open
http://localhost:5173in your browser - You should see the MeetMates login page
- Browser console should show Socket.IO connection established
Test Authentication Flow
- Click “Continue with Google”
- Select your Google account
- You should be redirected to the main application
- Check browser DevTools Network tab for successful API calls
Development Workflow
Running Both Servers
You’ll need two terminal windows/tabs: Terminal 1 (Backend):Hot Reloading
- Frontend: Vite provides automatic hot module replacement (HMR)
- Backend: You may want to install
nodemonfor auto-restart:
backend/package.json:
npm run dev
Common Issues
MongoDB Connection Failed
Error:MongoDB connection error
Solution:
- Verify MongoDB is running:
mongod --version - Check
MONGODB_URIin.envis correct - For Atlas, ensure your IP is whitelisted
CORS Errors
Error:Blocked by CORS
Solution:
- Verify
CORS_ORIGINin backend.envincludeshttp://localhost:5173 - Check that frontend is running on the exact port specified
Google OAuth Not Working
Error:Invalid Google token or OAuth popup doesn’t appear
Solution:
- Verify
VITE_GOOGLE_CLIENT_IDin frontend.envmatches Google Console - Check authorized JavaScript origins in Google Console
- Clear browser cache and cookies
Port Already in Use
Error:EADDRINUSE: address already in use :::3001
Solution:
Socket.IO Connection Failed
Error: Console shows Socket.IO connection errors Solution:- Ensure backend is running and accessible
- Check
VITE_BACKEND_URLin frontend.env - Verify no firewall is blocking WebSocket connections
Next Steps
- Review the Environment Variables documentation
- Understand the System Architecture
- Check the Authentication API for available endpoints
- Read about WebRTC Video Chat for video functionality
Development Tools
Recommended VS Code Extensions
- ESLint - JavaScript linting
- Prettier - Code formatting
- ES7+ React/Redux/React-Native snippets - React code snippets
- Thunder Client or REST Client - API testing
- MongoDB for VS Code - MongoDB integration
Debugging
Backend Debugging
Adddebugger statements or use VS Code’s built-in Node debugger:
Frontend Debugging
Use browser DevTools:- Console: View logs and errors
- Network: Monitor API calls and WebSocket connections
- Application: Inspect localStorage, session storage, and cookies
- React DevTools: Install browser extension for React debugging
Testing
Manual Testing Checklist
- User can sign up with college email
- User can log in with Google OAuth
- User can log in with ID card image
- Socket.IO connection establishes successfully
- User can start a chat (text-only)
- User can start a video chat
- WebRTC connection establishes between peers
- Messages are sent and received in real-time
- “Next” button connects to a new partner
- User disconnection is handled gracefully
- Online user count updates correctly