Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Mobile Chat App

Design the iOS app side of a text chat product: a conversation list and threads that open from data stored on the phone, messages that send reliably over weak networks, live updates while the app is open, notifications while it is closed, and older history loaded a page at a time.

Problem statement

Design the iOS app for a text chat product, and the small set of server calls the app needs. The interview is about the app: how it stores data on the phone, how it sends and receives messages, and how the screen stays correct when the network comes and goes.

For this exercise, assume the chat server already exists and you may define the calls and events it offers the app; how the server stores and fans out messages at scale is out of scope. Users chat one to one or in small groups. A user is signed in on one phone at a time. Messages are plain text.

Photos and other attachments, voice and video calls, typing indicators, read receipts, message edits and deletes, search, and end-to-end encryption are out of scope; all traffic uses HTTPS or a TLS connection.

Phones often lose the network for seconds or minutes (a train, an elevator), and iOS may suspend or end the app at any time once it is in the background. Your design should keep the screen usable without a network, never lose or double-send a message the user typed, and catch up correctly after the app was away.

What to build

  1. A user sees their conversations, each with the latest message preview and an unread count, and can open them even with no network.
  2. A user sends a text message in a one-to-one or group conversation; it shows in the thread at once, is delivered once the phone is online, and is never sent twice.
  3. A user sees new messages live while the app is open and gets a notification when the app is in the background or closed.
  4. A user scrolls back through a conversation's older messages, which load a page at a time.

At scale

  • For this exercise, assume a conversation has 2 to 50 members, an active user has up to a few hundred conversations, and a long conversation holds tens of thousands of messages, so the app cannot download or keep full history.
  • Your own message appears in the thread within 100 ms of tapping Send, even offline; while the app is open, a message from someone else appears within about 1 second of the server accepting it.
  • Opening the app shows the stored conversation list within 1 second with no network; catching up after a day offline takes a few requests, not one per conversation.
  • In the background the app must not poll the server every few seconds: that drains the battery, and iOS suspends background apps anyway.