Design a real-time messaging system like Slack or Discord.
Requirements:
Real-time messaging
Channels and direct messages
User presence (online/offline)
Message history and search
File sharing
Key Discussion Points:
Database selection (SQL vs NoSQL vs both)
Indexing strategies for messages
Fan-out approaches for message delivery
WebSocket connection management
Scale to millions of concurrent users
Common Follow-ups:
How to handle message ordering?
Read receipts implementation?
Push notifications?
Rate limiting?
Note: This round often has a senior interviewer who challenges your choices deeply. Be prepared to justify database, index, and fan-out decisions with specific reasoning.