← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Financial Transaction Audit Trails
Adopted Event Sourcing with Kafka for immutable audit trails instead of database triggers or CRUD, following Martin Fowler's reference architecture.
lesson_learnedevent-sourcingaudit-trailcompliancekafkapostgresql
Created 7/17/2026, 2:13:33 PM
Content
The team decided to replace standard CRUD in PostgreSQL with Event Sourcing for financial transaction audit trails. The transition was driven by compliance requirements for full history tracking (e.g., transaction #8821 status changes). Database triggers were considered but rejected because they lose business context — they capture row-level changes without intent. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, with a Postgres materialized view for fast frontend reads. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts. Reference: Martin Fowler's Event Sourcing Pattern article.