Realtime Chat System
RealtimeWebSocket-powered messaging with presence, typing indicators, and message persistence
7 nodes7 connections
Use Case
Team messaging apps, customer support chat, community platforms, collaborative tools
Stack Breakdown
ReactWebSocketRedis Pub/SubMongoDBS3
Architecture Layers
1Client Layer
2WebSocket Gateway
3Domain Services
4Pub/Sub Backbone
5Persistence & Storage
Components by Category
frontend
React
backend
WebSocket GatewayChat ServicePresence Service
database
RedisMongoDB
infra
S3
Why This Topology Works
WebSocket gateway handles persistent connections while Redis pub/sub distributes messages across server instances. Presence is kept separately from chat logic, allowing each to scale independently.
Scaling Notes
WebSocket servers scale horizontally with Redis pub/sub. MongoDB shards by room/channel. Presence state is ephemeral in Redis with TTL-based cleanup.
Observability
Track connection count, message throughput, and pub/sub lag. MongoDB slow queries on message history reads.