Write path
A transfer is validated, converted to a pair of journal entries, and committed in one database transaction. The external reference is unique, so a retried request returns the original transfer instead of writing a second one.
Read model
Projections are ordinary tables with a checkpoint per stream. Each projection handler receives ordered journal events, applies them, and persists its checkpoint in the same transaction as the change. Replaying a stream from zero is therefore safe and repeatable.
Queues
Projection work runs on database-backed queues. The queue is a delivery mechanism, not the source of truth: a lost job is replayed from the journal, and duplicate delivery is absorbed by the handler's checkpoint.
Invariants
- Debits equal credits for every transfer.
- A projection never reads the current journal; it folds events in order.
- No handler writes outside its own projection and checkpoint.
- Balance reads are served from projections, never recomputed per request.