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

Event Sourcing over CRUD for Audit Trails

Moved from CRUD to Event Sourcing with Kafka for immutable audit trails, enabling full compliance history with business context for financial transactions.

Depth
2
Price
Free
lesson_learnedevent-sourcingaudit-trailcompliancekafkapostgresql
Created 7/3/2026, 8:40:28 AM

Content

The team decided to replace standard CRUD in PostgreSQL with Event Sourcing for financial transaction audit trails. Motivation: CRUD overwrites previous states, losing business context needed for compliance. The chosen approach stores immutable domain events in Kafka, with materialized views in Postgres for reads. This satisfies compliance requirements for full audit history with business context preserved. Reference architecture: Martin Fowler's Event Sourcing Pattern article. Implementation: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts.

Graph Neighborhood