A full-stack simulation of WhatsApp Web built using React, Node.js, MongoDB, and Socket.IO. This application processes WhatsApp Business API webhook payloads, stores messages, and provides a real-time chat interface similar to WhatsApp Web.
- ✅ WhatsApp-like UI (responsive & mobile-friendly)
- ✅ View all conversations grouped by user
- ✅ Real-time message updates using Socket.IO
- ✅ Message status tracking: sent, delivered, read
- ✅ New chat creation with number + name input
- ✅ Input validation (only numeric numbers allowed)
- ✅ Messages stored in MongoDB (
processed_messages
) - ✅ Backend built with Express.js
- ✅ Vercel & Render Deployment ready
Layer | Technology |
---|---|
Frontend | React + Tailwind CSS |
Backend | Node.js + Express |
Database | MongoDB (via MongoDB Atlas) |
Real-time | Socket.IO |
Hosting | Vercel (Frontend), Render (API) |
.
├── backend
│ ├── app.js
│ ├── index.js
│ ├── routes/
│ ├── controllers/
│ ├── models/
│ └── .env
├── frontend
│ ├── src/
│ │ ├── App.jsx
│ │ ├── components/
│ │ │ ├── ChatList.jsx
│ │ │ ├── ChatWindow.jsx
│ │ │ └── SendBox.jsx
│ │ └── socket.js
│ └── .env
cd backend
npm install
PORT=5000
MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/whatsapp
node index.js
cd frontend
npm install
VITE_API_URL=https://your-backend-url.onrender.com
VITE_BACKEND_URL=https://your-backend-url.onrender.com
npm run dev
Note: Use
localhost
if running both locally.
- Accepts WhatsApp webhook JSON payloads
- Extracts messages and stores in
processed_messages
- Updates status on new webhook event
- Simulated with test JSON (use Postman)
- 👤 New Chat Creation: User can enter a mobile number + name to start a new conversation.
- 🧠 Validation: Only valid numbers are accepted.
- 🔄 Real-Time: Messages sent by one user are automatically updated for the recipient using WebSockets.
- 📦 Persisted: All messages are saved to MongoDB.
- Frontend: Vercel (https://whatsapp-web-xi.vercel.app)
- Backend: Render / Your own server
GET /api/messages?myWaId=919876543210
– Get grouped messagesPOST /api/messages
– Send a new messagePOST /api/webhook
– Webhook endpoint for message events
You can simulate sending messages by POSTing to:
POST /api/messages
Content-Type: application/json
{
"from_wa_id": "919876543210",
"to_wa_id": "912345678900",
"name": "John",
"number": "912345678900",
"message": "Hello from Postman"
}
new_message
— emitted by backend when a new message is stored- Frontend listens to this event and re-fetches the conversation
Yash Patel
MIT License – Use freely for learning and demo purposes.
---
Let me know if you'd like a GitHub-flavored README with collapsible sections or want to include CI/CD badges.