Apple's "Design Chat Application" interview question focuses on system design for a scalable, real-time messaging system supporting web, mobile, backend, and WebSocket technologies.
Design a chat application like WhatsApp or iMessage that handles one-on-one chats, group chats (up to 1000 members), message delivery with low latency (<100ms), offline support, file sharing (images, videos up to 100MB), typing indicators, read receipts, and end-to-end encryption. The system must scale to 100M+ daily active users (DAU), 1B+ messages/day, support iOS/Android/web clients, and ensure 99.99% availability. Prioritize real-time features using WebSockets, with fallback to long-polling. Clarify assumptions: global users, peak concurrency of 10M, data retention of 1 year.[1][7]
No official I/O formats from Apple, but typical flows (pseudocode API/WebSocket payloads):
Send Message (REST POST /api/messages/send)
Input:
json { "chat_id": "chat_123", "sender_id": "user_456", "type": "text", "content": "Hello!", "timestamp": 1640995200 }
Output:
json { "message_id": "msg_789", "status": "sent" }
WebSocket Message Receive
Event: message
Payload:
json { "event": "new_message", "chat_id": "chat_123", "message": { "id": "msg_789", "sender_id": "user_456", "content": "Hello!", "status": "delivered" } }
Group Create (POST /api/groups)
Input: { "name": "Team", "members": ["user1", "user2"] } → Output: { "group_id": "g_101" }[3]
Constraints Example: Max group size 1000, message size 1MB text/100MB media, rate limit 100 msg/min/user, retain 10k recent msgs/client-side.[5][1]