← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Audit Trail Compliance
Adopted Event Sourcing over CRUD for financial transaction audit trails to satisfy compliance requirements, using Kafka for immutable event storage and Postgres materialized views for reads.
lesson_learnedevent-sourcingaudit-trailcompliancekafkapostgresql
Created 7/20/2026, 4:38:07 PM
Content
The engineering team decided to replace standard CRUD with Event Sourcing for the financial transaction audit trail. Problem: database updates in PostgreSQL were overwriting previous states, making it impossible to provide compliance with full history (e.g., transaction #8821 status change). Alternatives: database triggers rejected (no business context). Event Sourcing selected with Kafka for immutable events and Postgres materialized views for reads. Reference: Martin Fowler Event Sourcing Pattern article. Code: Bob to implement event producers in src/services/transactionService.ts and consumer/store in src/events/eventStore.ts.