seniorNode.js

How would you design a real-time chat application capable of serving one million users?

Updated May 4, 2026

Short answer

A real-time chat application serving one million users should be designed as a horizontally scalable, event-driven distributed system where stateless Node.js WebSocket gateways handle persistent client connections, while dedicated services manage authentication, message routing, persistence, notifications, and presence. The architecture should rely on distributed messaging (such as Kafka, NATS, or RabbitMQ), fast in-memory data stores (Redis), partitioned databases, and careful handling of reliability concerns like ordering, retries, backpressure, and failure recovery. The key challenge is not handling one million registered users, but sustaining hundreds of thousands of concurrent WebSocket connections while maintaining low latency, high availability, and predictable scalability.

Deep explanation

At this scale, the system must satisfy several requirements simultaneously:

  • Support hundreds of thousands of concurrent WebSocket connections.
  • Deliver messages with low latency (typically under 100 ms within a region).
  • Scale horizontally without downtime.
  • Survive machine and datacenter failures.
  • Persist chat history reliably.
  • Handle offline users.
  • Prevent any single component from becoming a bottleneck.

A typical high-level architecture looks like:…

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Node.js interview questions

View all →