← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Audit Trails
Adopt Event Sourcing over CRUD to preserve audit trail and business context for financial transactions.
lesson_learnedevent-sourcingaudit-trailfinancial-transactionskafkapostgrescompliance
Created 8/1/2026, 6:06:56 PM
Content
The team decided to move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. The current CRUD approach loses business context on updates (e.g., can't track who changed status from pending to approved). Database triggers were considered but rejected because they don't capture user intent or business context — they only see row changes (status 1 to 2). The chosen approach is Event Sourcing using Kafka as the immutable event log, with materialized views in Postgres for fast frontend reads. Reference architecture: Martin Fowler's 'Event Sourcing Pattern' article. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.