Event-Driven Analytics
An e-commerce analytics backend that separates writes from reads with a transactional outbox and RabbitMQ.
The dual-write problem
Committing a database write and publishing an event are two operations. If either fails on its own, the read side silently drifts from the write side.
Transactional outbox
Events are written to an outbox table in the same transaction as the business data, then relayed to RabbitMQ — at-least-once delivery. Idempotent consumers absorb duplicates via a processed_events table, and poison messages land in a dead-letter queue.
- Node.js
- Express
- amqplib
- RabbitMQ 3
- PostgreSQL 14 ×2
- Docker Compose
- Pattern
- CQRS · transactional outbox · materialized views
- Guarantees
- At-least-once delivery · idempotent consumers · DLQ
- Services
- command :8080 · consumer · query :8081

