Skip to content
System Design Explorer
Interview problemintermediate

Notification Service System Design

A multi-channel push, email and SMS delivery platform

By Ankur NayakReviewed

Let any internal service send push, email, SMS and in-app notifications through one API, respecting user preferences, without duplicates or floods. Built from a validation API, priority queues, per-channel workers and third-party providers.

Open in Studio· edit a copy
Users
500M registered devices
Throughput
~100K notifications/s at peak
Storage
~10 TB delivery logs / year
Daily volume
~1B notifications
Transactional latency
< 2 s end to end
Notification Service system design architecture diagramComponents: Product Services, Notification API, Preferences & Devices (SQL + cache), Templates, Priority Queues (Kafka topics), Push Workers, Email Workers, SMS Workers, APNs / FCM, Email Providers, SMS Providers. Connections: Product Services to Notification API (send(user, template, data)); Notification API to Preferences & Devices (preferences, tokens); Notification API to Priority Queues (enqueue); Priority Queues to Push Workers; Priority Queues to Email Workers; Priority Queues to SMS Workers; Push Workers to Templates (render); Push Workers to APNs / FCM; Email Workers to Email Providers; SMS Workers to SMS Providers.Product ServicesServiceNotification APIAPI gatewayPreferences & DevicesSQL + cacheTemplatesNoSQL databasePriority QueuesKafka topicsPush WorkersWorkerEmail WorkersWorkerSMS WorkersWorkerAPNs / FCMExternal APIEmail ProvidersExternal APISMS ProvidersExternal API

Requirements

Functional

  • Send push (iOS/Android), email, SMS and in-app notifications
  • Respect per-user preferences, quiet hours and unsubscribes
  • Templates with localisation
  • Scheduled and bulk (campaign) sends
  • Delivery tracking and analytics

Non-functional

  • At-least-once delivery with deduplication, so users rarely see duplicates
  • Transactional notifications (OTP, receipts) delivered within seconds even during campaigns
  • Survive provider outages without losing notifications
  • Per-user rate limits to prevent spamming

In depth

A platform, not a feature

Every product team eventually needs to tell users something: a receipt, a login code, a reply, a sale. If each team integrates with Apple, Google, an email provider and an SMS provider on its own, you get inconsistent preferences, duplicate messages and no central place to stop a runaway job from spamming millions of people. A notification service gives everyone one API and owns the hard parts.

Accept fast, deliver asynchronously

The API does the cheap, decisive work up front: validate the request, drop duplicates using the caller's idempotency key, apply the user's preferences and quiet hours, enforce a per-user cap, then enqueue and return an ID. Everything slow (rendering templates and calling third parties) happens later in workers reading from a message queue.

Queues are split by channel and priority. A 50-million-recipient campaign goes on a low-priority topic, released gradually by a scheduler, while one-time passwords and receipts have their own topic and workers. Bulk traffic can be slow; transactional traffic can't.

Third parties will fail

Push notifications are delivered by Apple Push Notification service and Firebase Cloud Messaging: your workers send a payload and a device token over HTTP/2, and the platform does the last hop. Those services, and email and SMS providers, have outages and rate limits. Workers therefore wrap each provider in a circuit breaker, retry with exponential backoff, and keep a secondary provider for email and SMS. Messages that keep failing go to a dead-letter queue instead of disappearing.

Some notifications are worthless if late ("your driver has arrived"), so they carry an expiry and are dropped rather than delivered after the fact.

In-app and real-time

When the user has the app open, a persistent connection is faster and cheaper than a platform push. Uber's RAMEN push platform, for example, keeps persistent connections to rider and driver apps and reported over 1.5 million concurrent connections in its second generation.

What interviewers look for

  • An asynchronous pipeline with priority isolation
  • Preferences, unsubscribes and per-user rate limits
  • Idempotency and at-least-once delivery
  • Provider failure handling: retries, backoff, fallback, expiry
  • Tracking delivery status for support and analytics

Components

Product Services

Service. Orders, payments, social features: anything that triggers a notification.

Notification API

API gateway. Single entry point: authenticates the calling service, validates the payload and returns an ID immediately.

Building block: API Gateway

Validate

Service. Schema, template ID and recipient checks.

Idempotency Check

Redis

Cache. Drops a request whose idempotency key was seen recently.

Preferences

Service. Applies opt-outs, channel choices and quiet hours.

Per-user Limit

Service. Caps how many notifications one user gets per hour.

Building block: Rate Limiting Algorithms

Route by Priority

Service. Puts transactional and bulk sends on separate queues.

Preferences & Devices

SQL + cache

SQL database. User channel preferences, unsubscribes and device tokens for each user.

Building block: Cache

Templates

NoSQL database. Versioned, localised templates rendered per recipient.

Priority Queues

Kafka topics

Queue. Separate topics per channel and priority, so a marketing campaign never delays a password reset.

Why: Buffers bursts, isolates priorities and lets workers retry without losing work.

Building block: Message Queue & Event Log, Fan-out on Write vs. Read

Scheduler

Scheduler. Releases scheduled and campaign sends in rate-limited batches.

Push Workers

Worker. Render, look up device tokens and call APNs or FCM; remove tokens the providers report as invalid.

Building block: Circuit Breaker

Email Workers

Worker. Render HTML templates and hand messages to email providers.

SMS Workers

Worker. Send short messages through SMS providers, with country-specific routing.

In-app Gateway

Realtime gateway. Pushes notifications to users who currently have the app open over a persistent connection.

Building block: WebSockets & Persistent Connections

APNs / FCM

External API. Apple Push Notification service and Firebase Cloud Messaging deliver to devices.

Email Providers

External API. Primary and fallback email delivery services.

SMS Providers

External API. Carrier aggregators, with a fallback provider per region.

Delivery Log

Wide-column store

NoSQL database. Status of every notification (queued, sent, delivered, opened) for support and analytics.

Retry & Dead-letter

Queue. Failed sends retry with exponential backoff; persistent failures land here for inspection.

Request flows

Order shipped: a transactional push

  1. The order service calls the API with the user ID, a template and an idempotency key.
  2. The API checks the user allows push for order updates and finds their device tokens.
  3. The notification goes on the high-priority push topic; the caller gets an ID back immediately.
  4. A push worker consumes it.
  5. It renders the localised template with the order details.
  6. It sends the payload to APNs or FCM for each device token.

A marketing email campaign

  1. At send time the scheduler releases recipients in batches onto the low-priority email topic.
  2. Email workers consume at a controlled rate, separate from transactional traffic.
  3. Each rendered email goes to the email provider; bounces and unsubscribes flow back to preferences.

Failure scenarios

What if: aPNs or FCM has an outage?

Push workers' circuit breakers open and failed sends are scheduled for retry with backoff instead of being dropped. The queue holds the backlog, which drains when the provider recovers.

User impact: Push notifications arrive late; email and SMS are unaffected.

  • Circuit breakers per provider
  • Exponential backoff with jitter
  • Expire time-sensitive pushes (e.g. 'your driver is here') instead of delivering them late

What if: primary email provider is down?

Email workers detect errors and switch to the secondary provider for new sends; queued messages are retried there.

  • Two email providers with health-based routing
  • Shared suppression list so failover doesn't email unsubscribed users

Trade-offs

Synchronous send vs. queue

Accept, validate and enqueue; deliver asynchronously.

Pros
  • Callers return in milliseconds
  • Bursts and provider outages are absorbed by the queue
  • Retries are natural
Cons
  • Delivery is eventually, not immediately, confirmed

At-least-once vs. at-most-once

At-least-once delivery with idempotency keys and deduplication.

Pros
  • Important notifications aren't silently lost
Cons
  • Occasional duplicates if a provider accepts a message but the acknowledgement is lost

One queue vs. per-channel, per-priority queues

Separate topics per channel and priority.

Pros
  • A slow channel or a campaign can't block others
  • Independent scaling of workers
Cons
  • More topics and consumers to operate

Frequently asked questions

How do push notifications actually reach a phone?

Your server never talks to the phone directly. It sends the payload and the device token to Apple's APNs or Google's FCM over HTTP/2, and those services deliver it over the persistent connection the operating system keeps open.

How do you prevent duplicate notifications?

Callers send an idempotency key with each request, and the API drops repeats seen within a time window. Workers also record what they sent, so a retried job can skip notifications already delivered.

How do you keep marketing campaigns from delaying important notifications?

Put them on separate, lower-priority queues with their own workers and release campaign recipients through a rate-limited scheduler. Transactional notifications such as one-time codes have dedicated capacity.

Building blocks used

Sources