← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Audit Trails
Adopted Event Sourcing over CRUD to meet compliance audit requirements, using Kafka for immutable event storage and Postgres for read materialization.
lesson_learnedevent-sourcingaudit-trailcompliancekafkapostgresfinancial-transactions
Created 7/18/2026, 1:37:02 AM
Content
The team decided to replace standard CRUD in PostgreSQL with Event Sourcing for financial transaction audit trails. The decision was driven by compliance requirements for historical audit trails — specifically, the need to track who changed what and why. Database triggers were considered but rejected because they lose business context (a trigger sees a row change like status going from 1 to 2 but does not know the reason or user intent behind it). Instead, the team will use Kafka to store an immutable sequence of domain events (TransactionCreated, TransactionApproved, StatusUpdated), with a Postgres materialized view for fast frontend reads. The architecture follows Martin Fowler's Event Sourcing Pattern article. Implementation will include event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts.