KatInterview

Build a Multi-Channel Push and In-App Messaging Platform

System DesignModel answer
HardModel answerSystem Designsystem-designnotificationskafka

Last updated

Design a scalable messaging backend for a consumer mobile app that delivers push and in-app messages, honors user preferences, and stays reliable and legally compliant across regions.

You are asked to design the backend for a messaging platform that serves a large consumer mobile app with millions of daily active users. The platform sends mobile push messages (iOS and Android) and in-app inbox messages, and it must handle two kinds of traffic: event-driven messages (for example, "someone replied to you") and audience-targeted campaigns (for example, "a new feature is available in your country").

The platform must support:

  • User-controlled settings: which channels and categories are allowed, plus quiet hours.
  • Audience segmentation and targeting.
  • Duplicate suppression, per-user frequency limits, and idempotent submission.
  • Retries with backoff when delivery fails.
  • Scheduled sends and batching or digests.
  • A/B experiments on message variants.
  • Localized content.

In your answer, cover:

  1. Requirements and assumptions you would confirm first.
  2. Back-of-the-envelope capacity numbers (traffic, storage, connections).
  3. Public and internal APIs.
  4. The data model.
  5. The event pipeline, processing workers, and delivery workers, including how they integrate with Apple and Google push services.
  6. Scaling to millions of DAUs and running across multiple regions, including the consistency versus availability trade-offs.
  7. Monitoring and alerting.
  8. Privacy and legal compliance (GDPR, CCPA).
  9. Failure handling.
  10. A staged rollout plan.

Be explicit about trade-offs and justify the choices you make.

Hints

Hint 1

Separate the two traffic types early: event-driven messages are latency-sensitive while campaigns are high-volume and tolerant of delay. Think about how to keep a giant campaign from starving the urgent traffic.

Hint 2

Delivery inside the pipeline will be at-least-once, so think about where duplicates can appear (producer retries, consumer replays, provider retries) and put an idempotency or dedup mechanism at each of those points.

Hint 3

Treat the policy checks as an ordered chain per user: preferences and opt-outs, dedup, frequency caps, quiet hours, experiment assignment, then rendering. Partitioning by user ID makes most of that state local.

Hint 4

Decide which things must be strongly consistent (opt-outs, deletions) and which can favor availability (counters, delivery timing), and say so explicitly.