Every module is built for production — not just a demo. These features plug together as a cohesive system.
⚡
Server-Side Debouncing
3-mode engine: leading edge (immediate), trailing edge (after silence), and maxWait ceiling. Per-key timer maps with flush/cancel. Prevents MongoDB write storms.
★ Core Feature
💬
Real-Time Messaging
Socket.io with connection state recovery, per-user rooms, message delivery receipts, reactions, threading, and soft deletes. Cursor-based pagination for history.
Socket.io
🔔
Smart Notification Batching
20 events in 30s → 1 digest. Per-user debounce window (configurable). MaxWait ceiling ensures delivery. Quiet hours, muted rooms, per-device targeting.
Debounced
⌨️
Typing Indicators
Leading-edge broadcast (instant) + trailing-edge stop (1.5s silence). No matter how many keystrokes — only 2 socket events per typing session per user.
Socket.io
📴
Offline Message Queue
Missed messages stored in MongoDB with 7-day TTL. On reconnect: force-flush debounced notifications + deliver queued messages instantly via socket.
MongoDB
👁️
Change Streams
MongoDB Change Streams react to DB events in real-time — fan-out new messages, invalidate caches, and run debounced stats aggregation. Zero polling.
MongoDB
🔐
JWT Auth + Refresh Rotation
Access tokens (15min) + refresh tokens (7d) with rotation. Up to 5 simultaneous devices per user. Socket handshake auth. Role-based room guards.
Security
📊
Aggregation Pipelines
Room analytics with messages-per-day, top senders, hourly heatmaps. Unread counts via lastRead cursor. All computed server-side with MongoDB aggregation.
MongoDB
🚦
Tiered Rate Limiting
4 separate limiters: auth (10/15min), API (100/15min), messages (60/min), search (30/min). Keyed by userId when authed, IP when not. Exponential backoff on DB reconnect.
Redis