Why architecture matters here
Notification failures are visible and personal. A user gets 10 pings for the same thing. A quiet-hours violation wakes someone up. A compliance failure incurs fines. Every user has different preferences and channels.
The architecture matters because it must reconcile many concerns: preferences, dedupe, throttle, template rendering, channel-specific delivery, and compliance.
With the pipeline right, notifications drive engagement rather than churn.
The architecture: every piece explained
The top strip is the request path. Event source triggers a notification (order shipped, alert fires). Notification router applies policy + user preferences. Template engine renders content with i18n. Channels — email, push, SMS, in-app — deliver.
The middle row is the safety controls. Preferences store holds per-user opt-in/out. Dedupe prevents duplicates. Throttle + digest combines many events into a single batch. Delivery status tracks per-message and retries with backoff.
The lower rows are governance. Compliance enforces unsubscribe, CASL/CAN-SPAM/TCPA rules. Analytics tracks delivery + engagement. Ops handles quiet hours, regulatory rules, and on-call notification separately.
End-to-end flow
End-to-end: order ships → event fires. Router looks up user's preferences: opts into email + push, not SMS. Dedupe checks: no shipped-event for this order recently. Throttle: this user has 3 events in the last hour; digest kicks in. Template engine renders email in user's locale + push notification. Channels deliver. Delivery status confirms email delivered; push failed (device offline); retry queued. Compliance verifies unsubscribe link present. Analytics shows open rate 45%, click rate 12%.