This backend powers the Twalky Meet application — a real-time video meeting system built with WebRTC and Socket.IO.
It manages session creation, user participation, and peer-to-peer signaling between connected users.
- Real-time WebSocket signaling using Socket.IO
- Peer-to-peer WebRTC offer/answer handling
- ICE candidate forwarding between peers
- Session creation, validation & participant management
- MongoDB storage for sessions
- Express with CORS & JSON middleware
- Graceful shutdown handling
| Component | Technology |
|---|---|
| Backend Framework | Node.js + Express |
| Real-time Engine | Socket.IO |
| Database | MongoDB + Mongoose |
| Environment Variables | dotenv |
| API Format | REST + WebSockets |
git clone https://github.com/your-username/twalky-meet-backend.git
cd twalky-meet-backendCreate a .env file in the root directory with the following values:
MONGO_URL="your_mongodb_connection_string"
PORT=5000💡 Replace
"your_mongodb_connection_string"with your MongoDB URI (from MongoDB Atlas or local setup).
npm installnpm run devServer will run on
http://localhost:5000WebSocket will be active on the same URL.
| Method | Endpoint | Description |
|---|---|---|
| GET | /create-session |
Create a new meeting session |
| GET | /is-alive?sessionId=xxxx |
Check if a session exists |
| Event | Direction | Description |
|---|---|---|
prepare-session |
Client → Server | User is in Prepareing meet |
session-info |
Server → All | Infromation about participant in room |
join-session |
Client → Server | Join an existing session |
send-offer |
Client → Server → Receiver | Send WebRTC offer |
send-answer |
Client → Server → Receiver | Send WebRTC answer |
send-ice-candidate |
Client → Server → Receiver | Send ICE candidates |
new-participant |
Server → All | Notify participants of a new user |
participant-left |
Server → All | Notify participants when someone leaves |
hang-up |
Client → Server | Leave call gracefully |
disconnect |
Client → Server | Leave call gracefully |
twalky-meet-backend/
│
├── controllers/
│ └── socket.js # WebRTC signaling logic
│
├── models/
│ └── session.model.js # MongoDB session schema
│
├── database/
│ └── index.database.js # Database connection logic
│
├── .env # Environment variables
├── app.js # Main entry point
└── package.json
- User A joins →
join-session - User B joins →
new-participantevent sent to A - A creates offer → sends via
send-offer - B receives offer → creates answer → sends
send-answer - Both exchange ICE candidates via
send-ice-candidate - Connection established
| Command | Description |
|---|---|
npm install |
Install all dependencies |
npm run dev |
Start server in development mode |
npm start |
Start server in production mode |
- Ensure MongoDB is running and accessible before starting the backend.
- WebRTC communication requires the frontend to exchange SDP (offer/answer) correctly.
- Keep the Socket.IO version consistent across frontend and backend.
👩💻 Author: Soham Aswar 📧 Email: sohamaswar@gmail.com 🔗 LinkedIn: linkedin.com/in/sohamaswar
⭐ If you found this project useful, give it a star on GitHub! 🔼 Back to top