System Design: Group Chat
Design a scalable group chat system (like a basic Slack/WhatsApp group chat).
Core features
-
Users can create groups, join/leave groups, and manage membership.
-
Users can send messages to a group and receive messages on multiple devices.
-
Store message history and allow fetching recent messages.
Non-functional requirements
-
Low latency message delivery.
-
High availability and horizontal scalability.
-
Reasonable ordering guarantees within a group.
Explain:
-
APIs
-
Data model / storage
-
Real-time delivery mechanism
-
How you scale (sharding/partitioning)
-
How you handle offline users and multi-device sync
-
Tradeoffs (fanout, ordering, consistency)