Preparing your design workspace

Loading the problem and your latest saved attempt…

Design an Event-Driven Notification System

Design a reliable multi-channel notification platform for a high-cardinality internal producer fleet, with durable event handoff, fair admission, priority classes, bulk sends paced under provider rate limits, provider isolation, and recoverable poison messages.

Problem statement

Design a shared notification platform that product services use to send transactional notifications by email, push, and SMS.

A service publishes a domain event or calls an API after it commits a business change; the platform resolves a template and the recipient's preferences, creates one logical delivery per recipient and channel, sends it through an external provider, and reports delivery status.

Urgent notifications must go out first, and large bulk sends must stay within the rate limits that providers impose.

For this exercise, assume up to one million registered producer identities, meaning the internal services allowed to send notifications. Most of them are idle most of the time, so this is a count of identities, not one million requests per second.

Each producer has an authenticated stable identity, its own configurable admission policy, and observable usage; one producer's burst or malformed traffic must not exhaust shared capacity for others.

The user action that triggers a notification must not wait for an external provider, and duplicated or out-of-order work must not create uncontrolled duplicate sends.

For this exercise, also assume three priority classes. Critical covers one-time passcodes and security alerts. Standard covers the other transactional notifications, such as order and account updates.

Bulk covers one request that sends the same notice to many recipients, such as a service notice to every user in a city. A producer's registration lists the classes it may use, and each producer has a separate quota for its critical notifications, so a producer cannot simply mark everything critical.

Each provider account has a send-rate quota, for example 1,000 SMS per second, and rejects traffic above it.

Critical and standard notifications must keep their latency while a bulk send is running, and lower classes must not starve, meaning they must not wait without limit behind a steady stream of higher-priority work.

Be ready to discuss these choices and their trade-offs: why a monolith might be split into services; asynchronous event-driven communication versus synchronous calls, and what an event-driven design gains; Kafka versus RabbitMQ or Redis; where to place circuit breakers (guards that stop calling a failing dependency for a while); consumer race conditions; how to diagnose and repair a poison message (one that fails every time it is processed) and how a Kafka dead-letter queue (a separate queue that holds failed messages for inspection) fits in; and the outbox pattern (writing the outgoing event in the same database transaction as the business change) and the sidecar pattern (a helper process deployed beside each service).

Treat these as options to weigh, not as parts every design must include. Campaign management (audience targeting and campaign scheduling tools), the preference-management UI, the template-authoring UI, and provider onboarding are out of scope.

A separate sizing question asks for an API that handles 1,000,000 push notifications. No time interval or request grouping is given, and this count is unrelated to the one million producers above.

State an arrival interval, an average payload size, the provider drain capacity, and whether the target is acceptance or delivery before you estimate throughput and backlog. Keep enumeration of large recipient or delivery sets bounded in memory rather than assuming one request or one array holds the whole set.

These choices do not require a particular database or a rate of one million per second.

What to build

  1. For this exercise, a product service with an authenticated, registered producer identity can durably request a transactional notification without waiting for channel delivery, in a priority class its registration allows; a bulk request names a recipient set instead of one recipient. Admission applies independently configurable quota policy so one producer cannot exhaust shared capacity.
  2. For this exercise, the platform resolves a versioned template, recipient, channel eligibility, and the data needed for one logical notification.
  3. For this exercise, the platform attempts email, push, or SMS delivery through isolated provider adapters with bounded retry behavior, sends higher-priority work first without starving lower classes, and paces every send, including bulk sends, within each provider account's rate quota.
  4. For this exercise, authorized producers and operators can inspect status, diagnose poison messages, and safely redrive repaired work without duplicating completed delivery effects.

At scale

  • Design topics to cover: event-driven service boundaries, synchronous versus asynchronous communication, Kafka versus RabbitMQ or Redis, circuit breakers, consumer races, poison messages, Kafka dead-letter queues, outbox, and sidecar patterns.
  • Practice assumption: up to one million registered internal producers with sparse and uneven activity; this is a count of producer identities, not one million requests per second.
  • Practice assumption: support 100 million notification deliveries per day with peaks of 20,000 accepted notification intents per second.
  • Practice assumption: acknowledge durable acceptance within 500 milliseconds and begin the first delivery attempt within 5 seconds at p95 when the selected channel provider is healthy.
  • Practice assumption: events may be delivered at least once and out of order, providers may rate-limit or time out, delivery history is retained for 30 days, and dead-letter records are retained for 14 days before archival.
  • Sizing question: an API must handle 1,000,000 push notifications, with no time interval or request grouping given. Practice interpretation: state those missing workload assumptions explicitly and size acceptance, buffering and provider drain separately from the one-million-producer identity boundary.
  • Practice assumption: critical and standard notifications keep the 5-second p95 first-attempt target while a bulk send is running, and bulk keeps at least 10% of each provider quota whenever it has work waiting. A critical notification has a validity window, for example a passcode valid for 5 minutes, and is marked expired rather than sent late once the window ends. Provider quotas are per provider account, for example 1,000 SMS per second. One bulk request may reach up to 5 million recipients; it reports progress and an estimated finish time and can be paused or cancelled.