Run and deploy your AI Studio app
This contains everything you need to run your app locally with MongoDB integration.
View your app in :https://connect-chat-app-indol.vercel.app/
Prerequisites
- Node.js (v18 or higher)
- MongoDB (local installation or MongoDB Atlas account)
Setup
1. Install Frontend Dependencies
npm install
2. Set up Gemini API Key
Set the GEMINI_API_KEY in .env.local to your Gemini API key
3. Set up MongoDB Backend
Option A: Local MongoDB
- Install MongoDB locally
- Start MongoDB service
- Navigate to backend directory:
bash cd backend npm install - The
.envfile is already configured for local MongoDB
Option B: MongoDB Atlas (Cloud - Recommended)
- Create a free account at MongoDB Atlas
- Create a new cluster
- Get your connection string
- Navigate to backend directory:
bash cd backend npm install - Update
backend/.envwith your Atlas connection string:MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/connect-messaging
Run Locally
Start Backend Server (Terminal 1)
cd backend
npm run dev
The backend will start on http://localhost:3001
Start Frontend (Terminal 2)
npm run dev
The frontend will start on http://localhost:5173
Features
- 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
Offline Mode
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.
API Endpoints
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

Log in or sign up for Devpost to join the conversation.