← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Financial Transaction Audit Trails
Adopted Event Sourcing over CRUD to ensure immutable, auditable transaction history that preserves business context for compliance.
lesson_learnedevent-sourcingaudit-trailcompliancepostgresqlkafka
Created 7/3/2026, 12:29:48 PM
Content
The team decided to move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. The problem with CRUD is that updates overwrite previous states, losing compliance history (e.g., who changed transaction #8821 status from pending to approved). Database triggers were considered but rejected because they lose business context - triggers see row changes but not why the change happened or user intent. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka, with materialized views in Postgres for fast reads. Martin Fowler Event Sourcing Pattern article is the reference architecture. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.