System Requirements
Development
- Node.js 16.x or higher
- npm 8.x or higher
- MongoDB 5.x or higher
- 4GB RAM minimum
- Modern browser (Chrome, Firefox, Safari)
Production
- Node.js 18.x LTS recommended
- MongoDB Atlas or self-hosted
- SSL certificate (for WebRTC)
- 2GB RAM minimum per instance
- Linux server recommended
Frontend Installation
1. Clone and Navigate
2. Install Dependencies
The frontend uses React 19 with Vite as the build tool:Key Dependencies:
[email protected]- UI framework[email protected]- Build tool and dev server[email protected]- Real-time communication[email protected]- Styling[email protected]- Icons[email protected]- HTTP client
3. Configure Environment Variables
Create a.env file in the frontend directory:
frontend/.env
The URL where your backend server is running. For local development, use
http://localhost:3001. For production, use your deployed backend URL with HTTPS.Your Google OAuth 2.0 Client ID from Google Cloud Console. This is used for college email authentication.
4. Socket.IO Configuration
The Socket.IO client is configured infrontend/src/Socket.jsx:
frontend/src/Socket.jsx
The socket connection is set to manual (
autoConnect: false) to ensure proper authentication token handling before connecting.5. Run Development Server
http://localhost:5173
6. Build for Production
dist directory.
Backend Installation
1. Navigate to Backend Directory
2. Install Dependencies
Key Dependencies:
[email protected]- Web framework[email protected]- WebSocket server[email protected]- MongoDB ODM[email protected]- JWT authentication[email protected]- Google OAuth[email protected]- Password hashing[email protected]- Environment variables[email protected]- Cross-origin resource sharing
3. Configure Environment Variables
Create a.env file in the backend directory:
backend/.env
MongoDB connection string. For local development:
mongodb://localhost:27017/meetmatesFor MongoDB Atlas: mongodb+srv://username:[email protected]/meetmatesSecret key for signing JWT tokens. Must be at least 32 characters. Generate using:
Comma-separated list of allowed origins for CORS. Include both development and production URLs.
Port number for the backend server to listen on.
Your Google OAuth 2.0 Client ID for verifying Google authentication tokens on the backend.
4. Database Setup
The application uses MongoDB with the following schema:backend/models/User.js
5. Start the Server
6. Server Architecture
The backend server (backend/server.js) implements:
- HTTP Routes
- Socket.IO Events
- Matching Logic
Google OAuth Setup
Create Google Cloud Project
- Go to Google Cloud Console
- Click Select a project > New Project
- Enter project name (e.g., “MeetMates”) and click Create
Configure OAuth Consent Screen
- Go to APIs & Services > OAuth consent screen
- Select Internal if using Google Workspace, or External
- Fill in required fields:
- App name: MeetMates
- User support email: [email protected]
- Developer contact: [email protected]
- Click Save and Continue
Create OAuth 2.0 Credentials
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Select Web application
- Configure:
- Name: MeetMates Web Client
- Authorized JavaScript origins:
http://localhost:5173(development)https://yourdomain.com(production)
- Authorized redirect URIs: (leave empty for this implementation)
- Click Create
- Copy the Client ID
MongoDB Setup
Verification
Test Backend
Test Frontend
- Open browser to
http://localhost:5173 - Open browser console (F12)
- Check for:
- No CORS errors
- Socket.IO connection logs
- Google OAuth button renders
Test Full Flow
Socket Connection
- Check backend logs for “New user connected”
- Check frontend console for Socket.IO connection
Matching (requires 2 users)
- Open second browser window (incognito)
- Both users click “Start Chat”
- Should match and connect
Troubleshooting
Port Already in Use
Port Already in Use
MongoDB Connection Failed
MongoDB Connection Failed
CORS Errors
CORS Errors
Ensure Check backend logs for “Blocked by CORS” messages.
CORS_ORIGIN in backend .env includes your frontend URL:Google OAuth Not Working
Google OAuth Not Working
- Verify
VITE_GOOGLE_CLIENT_IDandGOOGLE_CLIENT_IDmatch - Check authorized JavaScript origins in Google Cloud Console
- Ensure Google+ API is enabled
- Check browser console for OAuth errors
WebRTC Connection Failed
WebRTC Connection Failed
- Grant camera/microphone permissions
- Use HTTPS in production (required for WebRTC)
- Check firewall settings for UDP ports
- Test with STUN/TURN servers if behind NAT
Socket.IO Not Connecting
Socket.IO Not Connecting
- Backend server is running
VITE_BACKEND_URLis correct- No firewall blocking WebSocket connections
Production Deployment
Frontend
Recommended Platforms:Environment Variables:
- Vercel
- Netlify
- Cloudflare Pages
VITE_BACKEND_URLVITE_GOOGLE_CLIENT_ID
Backend
Recommended Platforms:Environment Variables:
- Railway
- Render
- DigitalOcean
- AWS EC2
- All variables from
.envfile
Next Steps
API Reference
Explore backend API endpoints and Socket.IO events
Environment Variables
Advanced configuration options and customization