Notification Service

Send templated notifications over email, SMS, and push with preferences and retries.

Medium40 minObserverChannel strategyRetries

Design a notification service that other systems call to send messages to users over email, SMS, and push, honouring user preferences, templates, and retries. The design tests your use of Strategy and Observer, async processing with queues, and reliability concerns like idempotency and rate limits.

Requirements

Functional

  • Producers (order service, auth service) call send(user_id, event_type, data); the service decides channels and content.
  • Channels: email, SMS, push (extensible to WhatsApp, in-app).
  • Templates per event type and channel, with variable substitution and localisation.
  • User preferences: opt-in/out per channel and category (marketing vs transactional); quiet hours.
  • Priority: OTPs and security alerts bypass quiet hours and go first.
  • Retries with backoff on provider failure; fall back to another provider or channel.
  • Delivery status tracking.

Non-functional

  • Producers get a fast acknowledgement; delivery is asynchronous.
  • At-least-once delivery with deduplication (no double OTPs on retries).
  • Per-user and per-provider rate limits.
  • Provider outages must not lose notifications.

Try it first

Set a timer, sketch your own design on paper, then compare it with the reference walkthrough.

40:00

Complete & continue

Defend it out loud

The AI interviewer will probe your design for Notification Service and score it.

Mock interview