← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Audit Trails
Adopted Event Sourcing over CRUD with Kafka for audit trail compliance.
lesson_learnedevent-sourcingaudit-trailcompliancekafkapostgresfinancemartin-fowler
Created 7/30/2026, 2:36:28 PM
Content
The team decided to replace standard CRUD operations in PostgreSQL with Event Sourcing for financial transaction audit trails. Updates currently overwrite previous states, making it impossible to provide compliance history. The rejected alternative was adding a history_logs table with database triggers, but triggers lose business context. The decision: use Kafka to store an immutable event log and build materialized views in Postgres for fast reads. Implementation involves src/services/transactionService.ts and src/events/eventStore.ts. The decision follows Martin Fowler's Event Sourcing Pattern article.