Designing Whatsapp Messenger | System Design (original) (raw)

Last Updated : 6 Apr, 2026

Have you ever wondered how a widely used messaging app works behind the scenes? This article explores the system design of WhatsApp, explaining how it handles massive message traffic while ensuring security and reliability.

1. System Requirements

The WhatsApp messenger design should meet below requirements:

1. Functional Requirement

This section describes the core capabilities that the messaging system must provide for users.

2. Non-Functional Requirement

This section outlines performance, reliability, security, and scalability expectations for the system.

2. Capacity Estimation

This section estimates the system’s load, including the number of users, messages, and throughput requirements to ensure it can scale effectively.

**1. Storage Estimation:

100 billion messages are shared through WhatsApp per day and each message takes 100 bytes on average

**2. Bandwidth Estimation:

According to the storage capacity estimation, our service will get 10TB of data each day, giving us a bandwidth of 926 Mb/s.

**3. Number of Servers Estimation:

WhatsApp handles around 10 million connections on a single server, which seems quite high for a server.

3. High Level Design

This section outlines the overall architecture of the system, showing how different components interact to support messaging, notifications, storage, and delivery.

user_a

HLD

The following steps describe the communication between both clients:

4. Data Model Design

This section defines the structure of the database, including tables for users, messages, conversations, media, and message status to support efficient storage and retrieval.

1212

Data Model Design

5. API Design

This section outlines the key APIs used for messaging and media handling in the system.

1. Send Message

This API allows a user to send a text or media message to another user.

**Endpoint: POST /messages

**Parameters:

2. Get Message

This API fetches all unread messages for a user when they come online.

3. Upload File

This API is used to upload media files to the server before sending them to a recipient.

**Endpoint: POST /v1/media

**Parameters:

**Response: Returns a unique file_ID to be used when sending the file

4. Download Media File

This API allows users to download media files that were sent to them.

**Endpoint: GET /v1/media/download

**Parameters:

**Response: Returns the requested media file

6. Low Level Design

The Low-Level Design involves detailed interactions between components and the specific data flow within the system. Below are the specific technical interactions and components its .

qwqwq

Low level Design

1. WebSocket Server Connection

WebSocket is used for real-time communication between WhatsApp users. Each user’s device establishes a persistent WebSocket connection to the WebSocket server, allowing for real-time message delivery.

**Responsibilities

This section explains what the WebSocket Service is responsible for managing.

**Components

This section lists the main components used by the WebSocket Service.

**How It Works

This section describes the flow of establishing and using WebSocket connections.

**APIs

This section lists the APIs provided by the WebSocket Service.

2. Message Service

The Message Service handles the sending, storing, and retrieval of messages. It ensures that messages are persisted (in case of offline users) and delivered in order.

**Responsibilities

This section explains what the Message Service is responsible for managing.

**Components

This section lists the main components used by the Message Service.

**How It Works

This section describes the flow of sending, storing, and retrieving messages.

**APIs

This section lists the APIs provided by the Message Service.

3. Media Handling (Asset Service)

WhatsApp supports sharing media files such as images, videos, and audio. The Asset Service manages the upload, storage, and retrieval of these media files.

**Responsibilities

This section explains what the Asset Service is responsible for managing.

**Components

This section lists the main components used by the Asset Service.

**How It Works

This section describes the flow of uploading and delivering media files.

**APIs

This section lists the APIs provided by the Asset Service.

4. Group Message Handling

WhatsApp also supports group chats. The Group Service manages group data and facilitates message delivery to all users in the group.

**Responsibilities

This section explains what the Group Service is responsible for managing.

**Components

This section lists the main components used by the Group Service.

**How It Works

This section describes the flow of sending a group message.

**APIs

This section lists the APIs provided by the Group Service.

Approach to Achieve System Attributes

Non-Functional Requirement Approach
Minimizing Latency Use geographically distributed caching and CDNs (e.g., Cloudflare) to reduce delay in message and media delivery
Consistency Generate unique message IDs using sequencers and use FIFO messaging queues to maintain strict ordering
Availability Deploy multiple WebSocket servers, replicate user and group data across servers, and follow disaster recovery protocols
Security Implement end-to-end encryption to ensure secure communication between users
Scalability Optimize server performance and use horizontal scaling to handle increasing traffic and users