System Design AI

Push notifications in System Design Interviews: When to Use It and What to Say

Push notifications are a server-initiated message that reaches a client device even when the app is idle. In an interview you need to explain why they exist, how they are built, where they appear in classic designs, and what trade-offs you must consider.

The problem push notifications solve

Most web- or mobile-based services need to inform users about events that happen after the user has left the page or closed the app. Without push, the only option is client-side polling: the client repeatedly asks the server, "any new data?" Polling works but wastes bandwidth and introduces latency – a user might wait seconds before seeing a new chat message or a driver assignment.

A concrete system: a messaging app. When Alice sends a message to Bob, Bob may have the app in the background or the phone screen off. The user expects the message to appear instantly, not after a few seconds of polling. Push notifications let the server push the event directly to Bob’s device, waking the app and presenting the message as soon as possible.

How push notifications work – step by step

  1. Device registration – When the app first runs, it registers with the platform’s notification service (APNs for iOS, FCM for Android). The service returns a device token that uniquely identifies the app instance.
  2. Token storage – The backend stores the token alongside the user’s account. This is typically a simple key-value table: user_id → device_token.
  3. Event generation – An upstream event occurs (e.g., a new chat message). The service that owns the event creates a notification payload – a small JSON blob containing the message ID, sender, and a short preview.
  4. Push service request – The backend sends the payload to the platform’s push service, authenticating with a secret key. The request includes the target device token and optional priority flags.
  5. Delivery – The platform routes the payload to the device over a persistent, encrypted channel (TLS). The device’s OS receives the payload, wakes the app if needed, and delivers the data to the app’s notification handler.
  6. App handling – The app can either display a system notification (banner) or silently fetch the full message via a normal API call.

A tiny worked example

Imagine a chat service with three components: API Gateway, Message Service, and Push Service.

  • Alice sends a POST /messages to the gateway.
  • The gateway forwards the request to the Message Service, which stores the message and writes an entry to a notification queue.
  • A worker reads the queue, builds a payload {"msg_id":123,"sender":"Alice"} and calls FCM’s HTTP v1 endpoint https://fcm.googleapis.com/v1/projects/PROJECT_ID/messages:send with Bob’s device token.
  • FCM delivers the payload to Bob’s phone; the client app receives it and immediately fetches the full message via GET /messages/123.

The whole round-trip can be under 200 ms for a well-tuned system.

Where push notifications appear in classic interview questions

Interview questionWhere push fitsTypical component name on the board
Real-time chatDeliver new messages to offline usersPush Notification Service (uses FCM/APNs)
Ride-hailing (e.g., Uber)Notify drivers of a new ride requestDriver Notification Service (push to driver app)
Social feed (e.g., Twitter)Push new tweets or likes to a user's deviceFeed Push Service (push to mobile client)

In each case the push component sits after the core event generator (message store, ride-match engine, feed generator) and before the client. It is usually drawn as a thin box labeled with the platform’s service name.

Trade-offs and the alternative interviewers love to ask about

Latency vs. reliability

  • High priority push (e.g., apns-priority:10) asks the platform to deliver immediately, but can be throttled during network congestion.
  • Normal priority push may be delayed up to a few minutes; it conserves battery and is cheaper for the platform.

Scale and cost

  • Sending millions of pushes per day (≈12 per second) is trivial; billions (≈12 000 per second) requires sharding the notification queue and rate-limiting per token.
  • APNs and FCM do not charge per message, so the cost at scale is your own fan-out infrastructure (queues, workers, token storage) and any third-party delivery provider you choose to put in front of them.

Security and privacy

  • Payloads travel through the platform; sensitive data should never be placed in the payload. Use a silent push that only contains a reference ID, then fetch the data over an authenticated API.

Failure handling

  • Platforms return an error response when a token is no longer valid (both APNs and FCM report it as unregistered). The backend must prune stale tokens to avoid wasted calls.
  • If the push fails, a fallback poll (e.g., a short-interval background sync) ensures eventual consistency.

The alternative interview question

Interviewers often ask you to compare push with long-polling or WebSocket. Long-polling keeps an HTTP request open until an event arrives; it guarantees delivery but consumes a server connection per client. WebSocket offers a persistent bidirectional channel while the app is open, but mobile operating systems suspend background apps and their connections, so it complements push rather than replacing it: use the socket in the foreground and push to reach an idle device.

30-second spoken version

"Push notifications are server-to-device messages that let you inform a user about an event without the client polling. The device registers with APNs or FCM and gets a token, which the backend stores. When an event occurs, the backend builds a small JSON payload and sends it to the platform’s push endpoint. The platform routes it to the device, waking the app to display or silently fetch the full data. In interviews you’ll see push in chat, ride-hailing, and social-feed designs, and you should discuss latency, scaling the notification queue, token churn, and the fallback to polling or WebSocket."

Common mistakes candidates make

  • Treating push as a magic delivery guarantee – Forgetting to handle dead tokens, rate limits, and platform throttling.
  • Putting full payloads in the push – This can exceed size limits and leaks data; best practice is to send a reference ID and fetch the rest.
  • Ignoring battery impact – High-priority pushes on every event drain battery; candidates should mention batching or using normal priority for non-critical updates.
  • Skipping the registration flow – Interviewers expect you to explain how the client gets a token and why the backend must store it.
  • Over-engineering – Building a custom push protocol when the platform’s service already solves most reliability concerns.

How to practice this

  1. Study the worked design in the System Design AI library. It walks through a notification system step by step.
  2. Draw your own diagram on the canvas: include device registration, the notification queue, and the push service call. Use the provided rubric to check completeness.
  3. Run a mock interview: explain the flow out loud, then answer follow-up questions about scaling the queue, handling token churn, and comparing to WebSocket.

Questions people ask

When should I suggest push notifications in a design?

Use push when the user needs near-real-time alerts while the app may be idle or in the background, such as chat messages, ride requests, or social updates.

What is the biggest scalability bottleneck for push?

The notification queue and the rate limits imposed by the platform. Sharding the queue and batching pushes per user can mitigate the load.

How do I handle invalid device tokens?

Monitor the platform’s response codes; on a NotRegistered error, delete the token from your user-token table to avoid repeated failed calls.

Can I replace push with WebSockets?

WebSockets provide a persistent channel and eliminate a separate push service, but they consume a server connection per client and increase battery usage on mobile devices. Choose based on the expected active-user count and latency requirements.