Utoljára aktív 5 days ago

Interview prep notes

notify.md Eredeti

System Design: A Notification Service (Push, Email, SMS)

"Design a notification system" tests queues, fan-out, retries and user preferences, all common follow-up areas.

Requirements

  • Send push, email and SMS notifications, triggered by other services or scheduled campaigns.
  • Respect user preferences, opt-outs and quiet hours.
  • At-least-once delivery, with idempotency so users don't get duplicates.
  • Scale example: 10M notifications a day, with bursts during campaigns.

High-level flow

  1. Notification API: producers call POST /notify {user_id, template, data, priority}.
  2. Validation and preferences: check opt-outs, rate limits per user, and quiet hours.
  3. Message queue per channel (Kafka or SQS): separate queues so a slow SMS provider doesn't block push.
  4. Channel workers: render the template and call the provider (APNs, FCM, an email service, an SMS gateway).
  5. Delivery log: store status per message for retries, analytics and support.

Reliability details

  • Retries with exponential backoff and a dead-letter queue for permanent failures.
  • Idempotency key per notification so a retried job doesn't send twice.
  • Priority lanes: one-time passwords must not wait behind a marketing blast.
  • Provider failover: keep a second SMS or email vendor ready.

Data model

users_devices(user_id, device_token, platform), preferences(user_id, channel, enabled, quiet_hours), notifications(id, user_id, channel, status, created_at).

Good extras

Template versioning, per-tenant throttling, tracking opens and clicks for email, and batching low-priority messages into digests.


Disclosure: I work on Linkjob AI, an AI interview assistant. This is general prep material.