1 min read

System Design: Building a Notification Service

Notifications are deceptively complex. You need reliability, speed, and user control, all without spamming anyone.

Core Requirements

  • Deliver across channels (email, push, SMS).
  • Allow user preferences.
  • Support retries and deduplication.

High-Level Architecture

  1. Producer service emits events.
  2. Queue buffers delivery jobs.
  3. Workers send messages.
  4. Status stored for retries.

Idempotency Matters

Duplicate deliveries feel like bugs. Use an idempotency key per notification and store delivery status.

Retry Strategy

  • Exponential backoff.
  • Dead letter queue after max retries.
  • Alert on permanent failures.

Preference Management

Store preferences per user and enforce them before enqueueing. This avoids accidental delivery.

Final Thought

A notification system is a reliability system. Start with correctness, then optimize throughput.

Related Articles