Design a notification system (email, SMS, push).
Answer
- Other services call a Notification API with user, template and data.
- Validate, check user preferences/opt-outs and rate limits, render the template.
- One queue per channel (email, SMS, push) so a slow provider does not block the others.
- Workers call providers (SES, Twilio, FCM/APNs) with retries, exponential backoff and a dead-letter queue.
- Idempotency keys to avoid duplicates; track delivery status.
- Priority queues: critical messages (OTP codes) before marketing.
Practice this question in Repaso