Prepin
Log in

W

Designing the system: WhatsApp.

Approach / Explanation

This question requires you to develop a system that replicates the features of WhatsApp, a widely-used messaging app. Given that this system includes various elements such as chat servers, databases, real-time message delivery, read receipts, group messaging, media sharing, and voice calls, it can become quite intricate. You need to comprehend how these elements interact and how they can be designed to function effectively under high load conditions. In order to respond to this question, you should dissect each component and describe its implementation. Be sure to address key aspects like scalability, reliability, and real-time connectivity, which are essential for this type of system.

Suggested Answer

A platform similar to WhatsApp can be broken down into several key components. User Authentication - Users can register and log in using their phone numbers, with JWT (JSON Web Token) utilized for user authorization. Messaging System - Messages are transmitted over TCP/IP to ensure they are delivered. The intention is to implement a lightweight protocol like MQTT that supports message persistence. Message Storage - Messages may be stored redundantly across various regions for quicker access and disaster recovery, employing a consistent hashing mechanism across multiple databases (such as DynamoDB). Media Sharing - For sharing media files, a CDN service (like S3) can be utilized for images and videos, with content organized at the file level and a TTL-based caching strategy applied to minimize latency and costs. Presence System - A distributed caching solution (like Redis) can manage online/offline statuses, including the "last seen" timestamp. Push Notification - To alert users about new messages while they are offline, third-party notification services such as Google Firebase can be employed. The primary focus should be on ensuring the system is scalable and capable of managing a large amount of data.

Alternative Answer

When designing a system for a platform similar to WhatsApp, adopting a Microservices architecture is advisable. Users Service - This service manages user registration, login, and overall account management. Messages Service - This service is responsible for the messaging functionality. For real-time interactions, WebSockets can be utilized. A NoSQL database, such as MongoDB or Cassandra, can be used to store conversations due to their ability to handle large datasets and rapid data writing. Media Service - Media files can be stored in an AWS S3 Bucket, which offers high availability and fault tolerance with global backups. Notifications Service - Push notifications are valuable, and we can implement services like Firebase Cloud Messaging (FCM) to deliver notifications to users. Group Chat - A dedicated service should be created to manage group chats. This can be achieved through a publisher-subscriber model, where all group members subscribe to a shared platform, allowing them to receive any published messages. Voice and Video Calling Service - WebRTC can be employed for voice and video calling as it provides the necessary APIs for these functionalities. This architecture promotes high availability, isolates services for easier debugging, allows for independent scaling of components, and ensures efficient performance during heavy loads.

Question Details

Difficulty & Category

Medium
system design

Companies

Meta (Facebook)
WhatsApp

Product

For CandidatesFor RecruitersCompaniesBrowse JobsInterview QuestionsDeep ProfileSkill AssessmentOpportunity Matching
Prepin.ai

© 2026 Prepin LLC · Philadelphia, PA · All rights reserved.