
A distributed real-time chat application built with Next.js, Express, Socket.IO, and Redis Pub/Sub. Designed with a scalable architecture that synchronizes messages across multiple server instances for reliable real-time communication.




Scalable Real-Time Chat is a distributed chat application built to explore how modern messaging systems maintain real-time communication across multiple backend servers.
Instead of limiting communication to a single server instance, the application uses Redis Pub/Sub to synchronize messages between all running servers, allowing users connected to different instances to communicate seamlessly.
The project demonstrates how distributed messaging architectures improve scalability and reliability in real-time applications.
Traditional Socket.IO applications work well on a single server but struggle when deployed across multiple instances behind a load balancer.
This project addresses that limitation by introducing Redis Pub/Sub as a shared communication layer, enabling every server instance to receive and broadcast the same messages regardless of where the client is connected.
Client A Client B
│ │
▼ ▼
Socket.IO Socket.IO
│ │
▼ ▼
Server 1 Server 2
╲ ╱
╲ ╱
▼ ▼
Redis Pub/Sub
│
▼
Message Broadcast
The application separates client communication from message distribution.
When a user sends a message:
This approach enables horizontal scaling without breaking real-time communication.
Developing the application involved solving several distributed system challenges, including:
Planned enhancements include:
This project demonstrates how Redis Pub/Sub enables scalable real-time communication by decoupling message distribution from individual server instances. Rather than operating as a single-server chat application, it introduces a distributed messaging architecture capable of supporting horizontal scaling while maintaining a consistent user experience.