Idempotency in CQRS and Event Sourcing — Part 2: commands, projections and outbox

TL;DR AI
2 min readKey summary
The piece explains how duplicate requests can corrupt state in CQRS and event sourcing systems.
It shows how PostgreSQL-based command stores, atomic event persistence, and optimistic locking help prevent duplicate commands and concurrent write issues.
It also covers idempotent projections and outbox handling so repeated processing does not create inconsistent side effects.
These patterns reduce double charges, stale or inconsistent projections, and lost side effects in retry-heavy systems.

