Ravindra BagaleCourses & study guides Track your progress

Guides

WhatsApp Architecture Explained: How WhatsApp Delivers Messages Securely

Short answer: WhatsApp's chat servers are written mainly in Erlang, a language built for millions of long-lived connections. Messages are protected with end-to-end encryption based on the Signal protocol, so WhatsApp's servers pass along messages they cannot read. Photos and videos are encrypted on your phone and uploaded to a blob store. Since Meta bought WhatsApp in 2014, it runs in Meta's data centres. In 2024 to 2026 Meta added new privacy systems (IPLS for contacts, encrypted backups) and a Rust media library on devices.

Suppose you send a photo to your mother on WhatsApp

You are in Bengaluru and send a photo of your new flat to your mother in Kolhapur. Here is what happens:

  1. Your phone already has a secure session with your mother's phone, set up with the Signal protocol.
  2. Your phone encrypts the photo with a fresh random key and uploads the encrypted file to WhatsApp's blob store.
  3. Your phone then sends an end-to-end encrypted message to your mother with the key and a pointer to the file.
  4. This message travels over your phone's always-open connection to a WhatsApp chat server (Erlang).
  5. If your mother's phone is online, the server pushes the message to it at once. If not, the encrypted message waits on the server until she comes online.
  6. Her phone downloads the encrypted photo, decrypts it with the key and shows it. You see two ticks, then two blue ticks.

What architecture style does WhatsApp use?

WhatsApp is famous for doing a lot with a small team and a simple, focused design.

  1. Connection servers in Erlang: each phone keeps a long-lived connection to a chat server. In 2012 one server handled over 2 million connections at once.
  2. End-to-end encryption by default: the server routes messages but does not hold the keys. In 2023 WhatsApp added key transparency so people can check they are talking to the right keys.
  3. Privacy-first storage (2024 to 2026): IPLS stores contact lists so that even WhatsApp cannot read them (2024), and Meta strengthened end-to-end encrypted backups (2026).
  4. Rust on billions of devices (2026): WhatsApp rewrote its media-checking library in Rust to protect users from malicious files.
  5. Shared Meta infrastructure: WhatsApp now runs in Meta's data centres. The detailed current server layout is not publicly shared.

WhatsApp architecture diagram (public parts)

This diagram shows only what WhatsApp or its partners have shared publicly. Press Play to follow a request step by step.

Watch the orange dot follow each numbered step.
WhatsApp architecture from public information (simplified)Meta-owned data centresYour phone (keys never leave it)Simplified; based on publicly shared information.Your phoneSignal protocol keysMeta network edgeTLS/Noise connectionChat serversErlangOffline queueencrypted, until deliveredKey directorypublic keys, transparencyEncrypted backupsHSM-based vaultMonitoringnot publicly detailedMedia blob storeencrypted files
  1. Your phone encrypts the message with the Signal protocol.
  2. It travels over your always-open connection to Meta's edge.
  3. An Erlang chat server routes it.
  4. If the receiver is offline, the encrypted message waits in a queue.
  5. Public keys come from the key directory.
  6. Chat history backups can be end-to-end encrypted.
  7. Servers are monitored for health.
  8. Encrypted photos and videos sit in the blob store.
  9. The receiver's phone decrypts and shows it.
Diagram 1: the public parts of WhatsApp's architecture. Messages and media are end-to-end encrypted; servers cannot read them. Open the diagram as an image (PNG) · WebP

What does WhatsApp use? Main technologies

LayerWhat WhatsApp uses (public)What it does in simple words
Server languageErlang (on BEAM)Handles millions of connections
EncryptionSignal protocolOnly sender and receiver can read
Key checksKey transparency (2023)Verify you have the right keys
ContactsIPLS (2024)Private contact storage
BackupsEnd-to-end encrypted backups (2026 update)Protects your chat history
Device codeRust media library (2026)Checks files for malware
MediaEncrypted blob storeHolds encrypted photos and videos
HostingMeta data centresServers and storage

Which cloud provider does WhatsApp use?

WhatsApp uses no public cloud for its main service that is publicly known. It became part of Facebook (now Meta) in 2014 and runs in Meta-owned data centres. As of 2026 WhatsApp delivers end-to-end encrypted messaging to over 3 billion people.

How it started: Erlang and FreeBSD (2011 to 2014)

  1. In January 2012 one server passed 2 million simultaneous TCP connections, after tuning FreeBSD and Erlang.
  2. By 2014 WhatsApp had scaled Erlang on FreeBSD servers, split services into partitions and handled hundreds of millions of users with a small team.
  3. Since then, WhatsApp has moved onto Meta's shared infrastructure. Details of that move are not publicly shared.

How does WhatsApp store data?

  1. Messages are stored on your phone. The server keeps an encrypted message only until it is delivered.
  2. Media is encrypted on your phone and stored as an encrypted blob.
  3. Contacts can be stored privately with IPLS (2024).
  4. Backups can be end-to-end encrypted (Meta, 2026).
  5. Database technology for the servers today is not publicly shared.

How does WhatsApp monitor its systems?

How WhatsApp monitors its servers today is not publicly shared in detail. As part of Meta, it can use Meta's shared monitoring tools, but WhatsApp's own alerting setup is not publicly shared.

If we built an app like WhatsApp on AWS (illustrative)

Please read this first

This section is a learning design by Ravindra Bagale. It is not WhatsApp's real setup. WhatsApp runs in Meta's own data centres. We use AWS here because it is what you learn in the AWS course.

Suppose you want to build "KattaChat", a chat app for a college. Here is a simple AWS layout. Real end-to-end encryption needs a proven library such as the Signal protocol; never invent your own.

1. Network: VPC, subnets, route tables, gateways

  1. Create one VPC with CIDR 10.0.0.0/16 in the Mumbai region (ap-south-1).
  2. Use two Availability Zones (A and B), so one AZ failing does not stop the app.
  3. In each AZ make three subnets: public (load balancer, NAT gateway), private app (your code) and private data (databases, cache).
  4. Attach one internet gateway (IGW) to the VPC. Public route table: 0.0.0.0/0 → IGW. This route is what makes a subnet public.
  5. Private app route table: 0.0.0.0/0 → NAT gateway, so servers can download updates but nobody can connect in from the internet.
  6. Private data route table: only the local VPC route. Use VPC endpoints to reach S3, DynamoDB and SQS without going over the internet.

2. Compute: where the code runs

  1. ALB with WebSocket support in the public subnets.
  2. Chat servers on EKS in private subnets, keeping a WebSocket per phone.
  3. Workers read SQS and send push notifications.

3. Storage and databases

  1. S3 stores encrypted photos; CloudFront delivers them.
  2. DynamoDB holds undelivered encrypted messages, deleted after delivery.
  3. ElastiCache remembers which server each online user is connected to.
  4. Aurora for accounts and groups.

4. Monitoring

  1. CloudWatch alarms on connection count and message delay.
  2. X-Ray traces.
  3. Never log message contents.

Request flow diagram

Press Play. The numbered list below the diagram lights up with each step.

Watch the orange dot follow each numbered step.
If we built a WhatsApp-like app on AWS (illustrative)AWS Region (for example ap-south-1, Mumbai)VPC 10.0.0.0/16Availability Zone AAvailability Zone BPublic subnet 10.0.1.0/24RT: 0.0.0.0/0 → IGWPublic subnet 10.0.2.0/24RT: 0.0.0.0/0 → IGWApp subnet 10.0.11.0/24RT: 0.0.0.0/0 → NATApp subnet 10.0.12.0/24RT: 0.0.0.0/0 → NATData subnet 10.0.21.0/24RT: local onlyData subnet 10.0.22.0/24RT: local onlyvia VPC endpointsIllustrative learning design only. This is NOT the company's real setup.Userphone appRoute 53DNS lookupCloudFrontCDN edge cacheAmazon S3encrypted mediaIGWApplication Load Balancerspans both AZsNAT gatewayNAT gatewayChat serviceEKS pods (auto scaling)Chat serviceEKS pods (auto scaling)ElastiCacheonline users, sessionsAurorausers, groupsElastiCacheonline users, sessionsAuroraread replicaSQSpush notificationsDynamoDBmessage queue per userCloudWatch + X-Raymetrics, logs, traces
  1. You open KattaChat. Route 53 finds the address.
  2. Encrypted photos are fetched via CloudFront.
  3. CloudFront reads them from S3.
  4. Your WebSocket enters through the internet gateway.
  5. The ALB connects you to a chat pod.
  6. The chat service receives your encrypted message.
  7. ElastiCache says which pod your friend is on.
  8. If your friend is offline, DynamoDB keeps the message.
  9. A push notification job goes to SQS.
  10. CloudWatch watches delays.
  11. Your friend gets the message.
Diagram 2: an illustrative AWS design for learning. WhatsApp does not necessarily run like this; see the sections above for what is publicly known. Open the diagram as an image (PNG) · WebP

WhatsApp versus our AWS design

PartWhatsApp (public info)Our AWS design
HostingMeta data centresAWS, two AZs
Server languageErlangAny language on EKS
EncryptionSignal protocolSignal protocol library
Offline messagesEncrypted queue until deliveryDynamoDB with delete on delivery
MediaEncrypted blob storeS3 + CloudFront
MonitoringNot publicly sharedCloudWatch, X-Ray

Quick quiz: check what you learned

  1. Which language are WhatsApp's chat servers mainly written in?

    1. Erlang
    2. PHP
    3. Ruby
    4. Kotlin
    Show answer

    A. WhatsApp is famous for its Erlang servers.

  2. Who can read a WhatsApp message?

    1. WhatsApp support staff
    2. Only sender and receiver
    3. Any Meta server
    4. The mobile network
    Show answer

    B. End-to-end encryption means only the two phones have the keys.

  3. How are WhatsApp photos stored on servers?

    1. As plain JPG files
    2. Inside MySQL rows
    3. As encrypted blobs
    4. Printed in reports
    Show answer

    C. Media is encrypted on the phone before upload.

  4. What did WhatsApp write in Rust (2026)?

    1. The Erlang VM
    2. Its billing system
    3. Its website
    4. A media-checking library
    Show answer

    D. WhatsApp shipped a Rust media consistency library to billions of devices.