A real-time, scalable chat application built with Node.js, Socket.IO, Redis, and MongoDB. Designed for low-latency messaging and real-time user presence tracking.
Live Demo: https://scalable-chat-app-three.vercel.app
- Backend: Node.js, Express
- Real-time Communication: Socket.IO
- Database: MongoDB (Mongoose)
- Cache: Redis (online/offline presence)
- Frontend: React
- Deployment: Vercel (frontend), Render (backend)
- DevOps: Dockerized
- Security: End-to-End Encrypted
- Real-time messaging between users
- JWT-based authentication and protected REST APIs for secure user communication
- End-to-End Encryption using a hybrid cryptographic model to secure message content
- API rate limiting to protect backend services from abuse
- Online/offline presence tracking using Redis
- Instantaneous Typing Indicators
- Timestamp for each msg
- Persistent message storage in MongoDB
- Scalable architecture ready for multiple Socket.IO instances
- Redis for Presence: Fast, in-memory storage for ephemeral user status. Reduces database writes and latency.
- Socket.IO: Simplifies event handling, automatic reconnections, and room management.
- MongoDB: Reliable storage for messages while separating ephemeral presence state.
- User connects → Socket.IO handshake
- Redis updates online presence
- Messages are broadcast via Socket.IO and stored in MongoDB
- Redis broadcasts presence updates to all connected clients
- Disconnections handled; presence rebuilds on reconnect
- Redis for Presence: Chosen for speed and efficiency. Avoids hitting the main database for temporary state.
- Socket.IO over WebSockets: Easier to manage rooms, events, and reconnections.
- MongoDB for Persistence: Ensures message history is stored reliably, separating ephemeral vs permanent data.
