← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Audit Trails
Adopt Event Sourcing over CRUD to capture rich audit context for financial transactions, using Kafka for event log and Postgres materialized views for reads.
lesson_learnedevent-sourcingaudit-trailkafkapostgresqlcompliancecrud
Created 7/15/2026, 5:37:29 PM
Content
Decision: Move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. The team considered database triggers but rejected them because business context is lost (triggers only see row changes, not user intent). They will use Kafka for the immutable event log and Postgres materialized views for fast reads. Reference: Martin Fowler's Event Sourcing Pattern. Code locations: src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic).