Understand the Problem
In this chapter we explore the design of a chat system. Almost everyone uses a chat app. Figure 1 shows some of the most popular apps in the marketplace.
A chat app performs different functions for different people. It is extremely important to nail down the exact requirements. For example, you do not want to design a system that focuses on group chat when the interviewer has one-on-one chat in mind. It is important to explore the feature requirements.
Step 1 – Understand the problem and establish design scope
It is vital to agree on the type of chat app to design. In the marketplace, there are one-on-one chat apps like Facebook Messenger, WeChat, and WhatsApp, office chat apps that focus on group chat like Slack, or game chat apps, like Discord, that focus on large group interaction and low voice chat latency.
The first set of clarification questions should nail down what the interviewer has in mind exactly when she asks you to design a chat system. At the very least, figure out if you should focus on a one-on-one chat or group chat app. Some questions you might ask are as follows:
What kind of chat app shall we design? 1 on 1 or group based?
It should support both 1 on 1 and group chat.
Is this a mobile app? Or a web app? Or both?
Both.
What is the scale of this app? A startup app or massive scale?
It should support 50 million daily active users (DAU).
For group chat, what is the group member limit?
A maximum of 100 people
What features are important for the chat app? Can it support attachment?
1 on 1 chat, group chat, online indicator. The system only supports text messages.
Is there a message size limit?
Yes, text length should be less than 100,000 characters long.
Is end-to-end encryption required?
Not required for now but we will discuss that if time allows.
How long shall we store the chat history?
Forever.
In the chapter, we focus on designing a chat app like Facebook messenger, with an emphasis on the following features:
-
A one-on-one chat with low delivery latency
-
Small group chat (max of 100 people)
-
Online presence
-
Multiple device support. The same account can be logged in to multiple accounts at the same time.
-
Push notifications
It is also important to agree on the design scale. We will design a system that supports 50 million DAU.
Finished reading?
Mark it complete to track your progress.