Please enable JavaScript.
Coggle requires JavaScript to display documents.
Design a chat system - Coggle Diagram
Design a chat system
Step 1 - Understand the problem
and establish design scope
What kind of chat app shall we design? 1 on 1 or group based?
Both
Is this a mobile app? Or a web app? Or both?
Both
What is the scale of this app? A startup app or massive scale?
50 million DAU
For group chat, what is the group member limit?
100
What features are important for the chat app? Can it support attachment?
1 on 1, group, online indicator and text
Is there a message size limit?
100,000 characters
Is end-to-end encryption required?
No
How long shall we store the chat history?
Forever
Step 4 - Wrap up
Extend the chat app to support media files such as photos and videos
End-to-end encryption
Caching messages
Improve load time
Error handling
Step 2 - Propose high-level design and get buy-in
Connection
HTTP
Polling
Long Pooling
Websocket
High-level design
Stateless Services
Stateful Service
Third-party integration
Scalability
Data models
Message table for 1 on 1 chat
Message table for group chat
Message ID
Step 3 - Design deep dive
Service discovery
Message flows
1 on 1 chat flow
Message synchronization across multiple devices
Small group chat flow
Online presence
User login
User logout
User disconnection