A real‑time chat application built with the MERN stack and Socket.IO, enabling seamless user‑to‑user messaging.
Live demo: chat-app.vercel.app (if deployed) Repo folders: Frontend/ and Backend/
- User signup and login with JWT authentication
- One‑to‑one real‑time chat via Socket.IO
- Persistent chat history stored in MongoDB
- Message timestamps and ordering
- Online status indicator (if implemented)
- Typing indicators (optional)
- Mobile‑responsive UI
Note: Adjust this list to match your actual implementation.
Frontend: React (Vite) + Tailwind CSS Backend: Node.js, Express.js, Socket.IO Database: MongoDB (Mongoose) Auth: JWT Deployment: Vercel (frontend), Render/Railway (backend)
Chat-App/
├── Frontend/ # React client
│ ├── src/
│ ├── public/
│ └── package.json
└── Backend/ # Express + Socket.IO server
├── src/ or server.js
├── package.json
└── .env (local only)
- Node.js LTS and npm/yarn
- MongoDB (local or Atlas)
git clone https://github.com/Xabhi0811/Chat-App.git
cd Chat-Appcd Backend
npm installCreate Backend/.env:
Start backend:
npm run dev # or: npm startcd ../Frontend
npm installCreate Frontend/.env:
Start frontend:
npm run devOpen http://localhost:5173 in your browser.
Backend
PORT– server portMONGODB_URI– MongoDB URIJWT_SECRET– JWT signing secretCLIENT_URL– allowed frontend origin
Frontend (Vite)
VITE_API_URL– REST API base URLVITE_SOCKET_URL– WebSocket server URL
Auth
POST /api/auth/signup– register userPOST /api/auth/login– login userGET /api/auth/me– current user profile
Messages
GET /api/messages/:chatId– fetch chat historyPOST /api/messages– send message
Client → Server
join{chatId, userId}message:send{chatId, text}
Server → Client
message:new{message}user:joined{userId}
Frontend (Vercel)
- Set
VITE_API_URLandVITE_SOCKET_URLto backend URL
Backend (Render/Railway/VPS)
- Set
CLIENT_URLto deployed frontend - Enable WebSockets and configure CORS
Database
- Use MongoDB Atlas and set
MONGODB_URI
Backend
{
"scripts": {
"dev": "nodemon server.js",
"start": "node server.js"
}
}Frontend
{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
}
}- Add actual routes and socket events
- Confirm ports and env variable names
- Insert screenshots/GIF demos
- Add license info
Add UI screenshots or GIFs here.
Specify your license (e.g., MIT). Create a LICENSE file.
PRs are welcome! Please open an issue for major changes.
- Socket.IO for real‑time messaging
- MongoDB/Mongoose for database
- React + Tailwind for frontend
- Vercel/Render for deployment
- CORS errors: Ensure
CLIENT_URLmatches frontend URL and CORS is enabled - WebSocket not connecting: Check backend host supports sockets and correct URL is set
- .env not working: Verify
.envfile placement and naming