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

Event Sourcing over CRUD for Audit Trails

Team adopted Event Sourcing with Kafka for immutable financial transaction audit trails instead of CRUD or database triggers, to satisfy compliance requirements.

Depth
2
Price
Free
lesson_learnedevent-sourcingcrudaudit-trailkafkacompliancepostgresqlfinancial-transactions
Created 6/16/2026, 1:40:12 PM

Content

Team decided to adopt Event Sourcing over standard CRUD for financial transaction audit trails. Standard CRUD overwrites previous states, making it impossible to provide committed history (e.g., transaction #8821). Database triggers with a history_logs table were considered but rejected because triggers lose business context. The chosen architecture uses Kafka for an immutable event log with a materialized view in Postgres for fast reads. Implementation: src/services/transactionService.ts (producers) and src/events/eventStore.ts (consumer). Reference: Martin Fowler Event Sourcing Pattern.

Graph Neighborhood