PROJECT / 001
OrderFlow
Transactional commerce & outbox backend.
01 / THE PROBLEM
The engineering problem
Commerce applications involve multiple connected entities and operations. In distributed architectures, saving order data to PostgreSQL and publishing an event (OrderCreated) to a message broker are separate operations. If the database commits but broker communication fails, downstream services never receive the event—the fatal dual-write problem.
CONSTRAINTS
Dual-write atomicity
Concurrent stock updates
Broker delivery guarantee
ENGINEERING FOCUS
Transactional Outbox pattern
Pessimistic locking / SKIP LOCKED
At-least-once with idempotent consumer
02 / ARCHITECTURE
How the system works
ORDERFLOW / TRANSACTIONAL ARCHITECTURE & OUTBOX
IDLE / RUNNING SYSTEMOrderFlow transactional pipeline: Service coordinates product verification, inventory decrement, and outbox insertion in one database transaction.
03 / IMPLEMENTATION
What was built
- 01Designed relational models for products, inventory, orders, order items, outbox events, and payments.
- 02Implemented Transactional Outbox pattern: order creation and event publication are saved in a single database transaction.
- 03Built a relay worker process polling the outbox table via SELECT ... FOR UPDATE SKIP LOCKED to prevent duplicate processing.
- 04Configured RabbitMQ exchange, consumer queues, TTL-backed retry queues, and dead-letter exchanges (DLX).
- 05Secured authentication workflows with Argon2 password hashing and JWT authorization.
- 06Managed versioned schema evolution with Alembic migrations.
04 / DECISIONS
Technical decisions
05 / RELIABILITY
Reliability and failure handling
06 / LIMITATIONS
Known limitations and future work
Advanced distributed data consistency, transactional outbox pattern, message broker resilience, and relational data modeling.