Lesson 15 of 15Production Case Study: Amazon Style Notification Platform

Production Case Study: Amazon Style Notification Platform

Now connect the full system. Imagine an ecommerce platform where a customer buys a product, payment succeeds, warehouse packs it, courier picks it up, and the package is delivered.

The same event-driven foundation works beyond ecommerce. In the AI compliance marketplace case study, business onboarding, document processing, review, and approval states create similarly important notification events.

Business Journey

Process flow7 steps
  1. 01
    Customer
  2. 02
    Adds product
  3. 03
    Checkout
  4. 04
    Payment
  5. 05
    Warehouse
  6. 06
    Courier
  7. 07
    Delivered

Every step can create notifications for different people.

Event Map

StepEventReceiversChannels
Checkout startedCheckoutStartedcustomerin-app, push
Payment successPaymentSuccesscustomer, financeemail, in-app
Order placedOrderPlacedcustomer, selleremail, push
Pick list readyWarehousePickRequestedwarehouse staffinternal app
Package shippedPackageShippedcustomerpush, SMS optional
Out for deliveryOutForDeliverycustomerpush, SMS
DeliveredPackageDeliveredcustomer, sellerpush, email digest

Complete Architecture

Complete Notification Platform

Architecture flow
Business domains
Own business transactionsProduct Services
Transactional handoff
Commits events atomicallyOutbox Tables
Event transport
Distributes durable eventsEvent Broker
Notification domain
Applies preferences and policyNotification Service
State and buffering
System of recordPostgreSQL
Fast lookupRedis Cache
Priority buffersQueues
Parallel processing
Scales by channel and priorityWorker Fleet
Delivery channels
Inbox deliveryEmail
Mobile deliverySMS
Device deliveryPush
Product inboxIn-app

Checkout Example

When payment succeeds, the payment service writes the payment row and outbox event in one transaction.

BEGIN;

UPDATE payments
SET status = 'success'
WHERE id = 'pay_123';

INSERT INTO outbox_events (id, event_type, payload, status)
VALUES (
  'evt_payment_123',
  'PaymentSuccess',
  '{"paymentId":"pay_123","orderId":"ord_123","userId":"user_123"}',
  'pending'
);

COMMIT;

The outbox relay publishes PaymentSuccess. Notification Service consumes it, checks preferences, creates notification rows, and enqueues jobs.

Channel Decisions

Payment success:

Email
receipt and invoice
In-app
account activity
Push
optional confirmation
SMS
not needed unless risk or regulation requires

Out for delivery:

Push
fast and cheap
SMS
useful when courier is close or app is not installed
Email
too slow for this moment
In-app
useful for tracking page

Security alert:

Email
durable record
Push
immediate
SMS
fallback for high risk
In-app
account audit trail

Queue Routing

function selectQueue(notification: NotificationJob) {
  if (notification.category === "security") return "security-critical";
  if (notification.channel === "sms") return "sms-urgent";
  if (notification.channel === "email") return "transactional-email";
  if (notification.channel === "push") return "transactional-push";
  return "marketing-bulk";
}

This function protects urgent notifications from bulk traffic.

Retry and DLQ

FailureRetry?Action
Provider timeoutYesExponential backoff
Provider 429YesDelayed retry with rate limit
Invalid emailNoMark failed
Missing template variableNoDLQ and alert
Expired push tokenNoDisable token

Monitoring

For this case study, alerts should cover:

payment email p95 latency > 60 secondsout-for-delivery push p95 latency > 10 secondssms spend above daily budgetsecurity queue age > 30 secondstransactional DLQ count > 0provider failure rate > 10 percent

Production Walkthrough

  1. Customer pays for order.
  2. Payment service commits payment and outbox event.
  3. Event broker receives PaymentSuccess.
  4. Notification Service creates email and in-app notifications.
  5. Email job enters transactional email queue.
  6. Worker renders invoice email template.
  7. Provider accepts email and returns message ID.
  8. Delivery attempt is marked accepted.
  9. Provider webhook later marks delivered or bounced.
  10. Dashboard shows status to support.

A production notification platform is not one API call. It is an event, preference, template, queue, worker, provider, status, retry, and monitoring pipeline.

Common Mistakes

  1. One queue for all ecommerce notifications.
  2. No outbox around payment events.
  3. Treating provider accepted as final delivery.
  4. Sending SMS for every step and creating cost waste.
  5. No support-facing status trail.

Interview Questions

  1. Walk through order confirmation from event to email delivery.
  2. Which notifications should use SMS in ecommerce?
  3. How would you prevent duplicate invoice emails?
  4. What metrics prove the system is healthy?

Exercise

Extend this design for returns and refunds. Define events, receivers, channels, queues, retries, and monitoring alerts.

What you will learn

How the full ecommerce notification journey works.

Which channels are used at each business step.

Which queues, workers, and providers own each notification.

How database, retries, monitoring, and security connect end to end.

Production checklist

  • Every business step emits an event
  • Channels are selected by urgency
  • Queues are separated by priority
  • Workers are channel-specific
  • Retries and DLQs are defined
  • Monitoring covers user impact