HARDReal-time Systems

Design Slack/Discord

Design a real-time messaging platform like Slack or Discord supporting channels, direct messages, file sharing, and presence indicators.

Estimated Time: 45 minutes
#WebSocket#Message Queue#Presence#Real-time
Solution Overview

Use WebSocket connections for real-time messaging. Implement message fanout through pub/sub, store messages in time-series optimized storage.

Hints to Get Started
1

How to handle millions of concurrent WebSocket connections?

2

Message ordering guarantees

3

Presence heartbeat mechanisms

Protocols

WebSocket for real-time, HTTP for REST APIs, gRPC for internal services

Components
  • WebSocket Gateway
  • Message Service
  • Presence Service
  • File Storage (S3)
  • Search Service (Elasticsearch)