0%
Mobile System Design Interviews: Architecture, Offline Sync, Networking, Media, Push and Performance
Walkthrough: Design a Mobile Chat App
Design a chat app is the most common prompt in the mobile system design round, and it is popular for a good reason. Almost every hard problem a mobile client faces shows up in it at once. Messages must appear instantly even when the network is bad. They must never be lost or duplicated. The app is suspended most of the day, yet the user expects to hear about a new message within seconds. Photos and voice notes are large and the radio is slow. People use two or three devices and expect them to agree. This lesson walks the full six step framework from the first lesson of the course on this prompt, and spends most of its time on the deep dives an interviewer will push on.
You will not design the backend fan out, the storage cluster or the encryption protocol in detail. The interviewer wants the client: what lives on the device, how it talks to the server, and how it behaves when the device does what devices do. Say that early. A sentence such as I will treat the backend as a service with a defined contract and spend my time on the app and that contract keeps you out of the most common trap in this round.
Scope the product before anything else
Start by restating the prompt and asking which product you are building. One to one and group messaging for a consumer app, like a general messenger, is the usual default. A workplace chat with channels and threads is different, and so is customer support chat inside a shopping app. Ask, then propose a default. A reasonable core list for a consumer messenger looks like this:
- A conversation list sorted by latest activity, with a preview line and an unread count.
- A conversation screen with history that loads as you scroll up.
- Sending text with instant display and visible delivery states: sending, sent, delivered, read, failed.
- Receiving messages in real time while the app is open, and a notification when it is not.
- Photo messages, with voice notes as a stretch goal.
- The same account on a phone plus at least one other device.
Then say what you are leaving out unless the interviewer wants it: voice and video calls, stories, message search, reactions, bots and payments. Group size matters too. Ask for the largest group. A cap of around a thousand members lets you treat groups like large one to one chats on the client. Broadcast channels with a million followers need different read receipt and fan out rules, and you should say that you would not show per member receipts there at all.
Non functional requirements the device cares about
The interviewer is listening for requirements that only make sense on a phone. Name them explicitly and attach a target to each one where you can.
Instant local feedback. The user's own message must appear in the conversation within one frame of tapping send, whatever the network is doing. No lost messages. A message the user sent must eventually reach the server even if the app is killed, the phone reboots or the network is gone for a day. No duplicates. Retries must never create two copies of the same message for the recipient. Correct order. Messages in a conversation appear in one agreed order on every device. Freshness. Incoming messages appear within about a second while the app is in the foreground, and a notification arrives within seconds when it is not, subject to what the operating system allows. Battery and data. The app must not hold the radio awake in the background or redownload media it already has. Storage. Chat history can grow to gigabytes, so the app needs limits and a way to free space.
Two quieter requirements earn credit at senior level. Accessibility: the conversation screen must work with VoiceOver and TalkBack, which means new messages are announced and delivery states have spoken labels, not only tick icons. Privacy: message content must not appear in places the user did not expect, such as logs, crash reports or screenshots in the app switcher if the product hides them.
Put rough numbers on it
Numbers keep the later choices honest. A heavy user might send fifty messages a day and receive five hundred across thirty active conversations. A text message with metadata is around a few hundred bytes on the wire and maybe one kilobyte in the local database with indexes. Five hundred messages a day is about half a megabyte a day of text, so a year of history is around two hundred megabytes for a heavy user before media. That tells you the local store can hold months of history and still needs pagination in the UI and an eviction policy for very old conversations.
Media dominates. A compressed photo is a few hundred kilobytes, and a short video is several megabytes. If the user receives twenty photos a day, media grows by gigabytes per month. That is why you will keep full resolution media out of the database, store files on disk with a size cap, and let the user see and clear storage per conversation.
For the connection, one WebSocket per device is enough. Even a busy group delivers a few messages per second at peak, which is trivial bandwidth. What matters is the number of radio wake ups, not bytes, which is why typing indicators and receipts will be batched and throttled later.
Platform constraints that shape the design
State the constraints of the device as facts the design must respect. On iOS, an app moved to the background is suspended within seconds unless it has a specific background mode, and a suspended app cannot keep a WebSocket open. On Android, an app in the background is subject to Doze and App Standby buckets, background services are heavily restricted, and a socket held open in the background will be cut or will drain battery for no benefit. So the live connection exists only while the app is in the foreground. Everything that happens while the app is closed must go through the platform push services, APNs on iOS and Firebase Cloud Messaging on Android.
Push itself has limits. A notification payload is capped at around 4 KB on both services, so you cannot send a long message or an image through it. Silent background pushes on iOS are throttled and may not be delivered at all, and on Android high priority messages that do not lead to a visible notification can be downgraded. These limits change between OS releases, so phrase them as approximate in the interview, but design as if push is a best effort doorbell rather than a delivery channel.
Finally, old versions. Some users will run an app version that is a year old. The wire protocol and API must stay compatible with them, which you will plan for in the release step.
Questions worth asking about the product
A few questions change the design more than others, so ask them even if the interviewer seems keen to move on. Is the chat end to end encrypted? If yes, the server cannot generate notification previews or search history, and the push path needs an extension on the device. Must history be available on a new device? If yes, the server is the long term store and the device is a cache; if not, the device is the primary store and backups become a product feature. How long can a user be offline and still expect their queued messages to go out? Hours and days lead to different retry windows and server side idempotency retention. Do we support low end Android phones on slow networks in emerging markets? If yes, payload size, app size and memory budgets get tighter targets, and features such as automatic media download should default to Wi Fi only.
Write the answers next to the requirements list. They are decisions you will refer back to in every later step, and the interviewer can see you are building on agreed facts rather than on assumptions.
What the interviewer is checking in step one
The interviewer is looking for three things in these first six to eight minutes. First, that you scoped a product rather than listing every feature of a famous messenger. Second, that your non functional list is about the device: instant feedback, durability across app death, battery, storage and OS limits. Third, that you used rough numbers to justify a decision, such as keeping media out of the database. Close the step with a one sentence summary and a check in: the core is reliable send and receive with delivery states, history, photos and multi device, on a client that must survive being killed and offline. Shall I sketch the client architecture next?
Within the first two minutes, tell the interviewer you will treat the chat backend as a service with a contract and spend your time on the app. It stops you drifting into fan out and storage clusters, which is the most common way strong backend engineers lose this round.