📌 links that will 10X your system design on this one (visual explanations and diagrams are 🔥 there so have a look as this is smth you’ll need in your interviews):
Understanding the Requirements
Before jumping into the architecture, we need to nail down the requirements. Some key questions to ask include:
- One-on-one chats vs. Group chats? Do we need to support both? How large can groups be?
- Real-time vs. Near Real-time? How important is immediate delivery? Can we tolerate a slight delay?
- Persistence? Do we need to store message history? For how long?
- Media Support? Will users be able to send images, videos, files?
- Read Receipts? Do we need to show users when their messages have been read?
- Online/Offline Status? Do we need to indicate which users are online?
- Push Notifications? Will we send push notifications for new messages?
- End-to-End Encryption? A must-have feature to prevent eavesdropping by any third party.
- Scale? How many users will the system need to support? What's the expected message volume?
Let's assume the following requirements for our design:
- Support for one-on-one chats and group chats (up to 50 users).
- Real-time message delivery is crucial.
- Message history should be stored indefinitely.
- Support for sending images and short videos.