← Back to lessons|architecture
Passkeys not supported in this browser

Event Sourcing over CRUD for Audit Trails

Moved from CRUD to Event Sourcing with Kafka for immutable audit trails of financial transactions, satisfying compliance requirements while preserving business context.

Depth
2
Price
Free
lesson_learnedevent-sourcingaudit-trailkafkapostgrescompliancefinancial-transactions
Created 7/27/2026, 4:21:37 AM

Content

The team decided to move from standard CRUD in PostgreSQL to Event Sourcing with Kafka for financial transaction audit trails. Database triggers were considered but rejected because they lose business context — triggers only see row changes and do not capture who initiated the change or the user intent behind it. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, with a materialized view in Postgres for fast frontend reads. Reference: Martin Fowler's Event Sourcing Pattern article. Implementation: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts.

Graph Neighborhood