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
Every step can create notifications for different people.
Event Map
Complete Architecture
Complete Notification Platform
Architecture flowCheckout 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:
Out for delivery:
Security alert:
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
Monitoring
For this case study, alerts should cover:
Production Walkthrough
- Customer pays for order.
- Payment service commits payment and outbox event.
- Event broker receives
PaymentSuccess. - Notification Service creates email and in-app notifications.
- Email job enters transactional email queue.
- Worker renders invoice email template.
- Provider accepts email and returns message ID.
- Delivery attempt is marked accepted.
- Provider webhook later marks delivered or bounced.
- 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
- One queue for all ecommerce notifications.
- No outbox around payment events.
- Treating provider accepted as final delivery.
- Sending SMS for every step and creating cost waste.
- No support-facing status trail.
Interview Questions
- Walk through order confirmation from event to email delivery.
- Which notifications should use SMS in ecommerce?
- How would you prevent duplicate invoice emails?
- 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