This contains everything you need to run your app locally with MongoDB integration.
View your app in :https://connect-chat-app-indol.vercel.app/
- Node.js (v18 or higher)
- MongoDB (local installation or MongoDB Atlas account)
npm installSet the GEMINI_API_KEY in .env.local to your Gemini API key
- Install MongoDB locally
- Start MongoDB service
- Navigate to backend directory:
cd backend npm install - The
.envfile is already configured for local MongoDB
- Create a free account at MongoDB Atlas
- Create a new cluster
- Get your connection string
- Navigate to backend directory:
cd backend npm install - Update
backend/.envwith your Atlas connection string:MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/connect-messaging
cd backend
npm run devThe backend will start on http://localhost:3001
npm run devThe frontend will start on http://localhost:5173
- Real-time messaging with MongoDB persistence
- User profiles with avatars
- AI chatbot integration (Gemini)
- Automatic fallback to localStorage if backend is unavailable
- Message history across devices
- Group chat functionality
If the backend is not running, the app automatically falls back to localStorage for offline functionality. Data will sync to MongoDB when the backend becomes available.
The backend exposes the following endpoints:
POST /users- Register or retrieve userGET /users- Get all usersPOST /messages- Send a messageGET /messages?u1=userId1&u2=userId2- Get messages between users
See backend/README.md for detailed API documentation.
connect-admin username eou8RaUNJNqGRn5I password
mongodb+srv://:@cluster0.rjmijfs.mongodb.net/?appName=Cluster0