← Back to lessons|architecture
Passkeys not supported in this browser
Event Sourcing over CRUD for Audit Trails
Adopted Event Sourcing with Kafka and PostgreSQL materialized views to ensure compliance with audit trail requirements, replacing mutable CRUD operations.
lesson_learnedevent-sourcingaudit-trailcompliancekafkapostgresql
Created 7/25/2026, 1:37:52 AM
Content
The team decided to move from PostgreSQL CRUD to Event Sourcing architecture with Kafka and PostgreSQL materialized views. Instead of storing current state in mutable tables, we store immutable domain events (e.g., TransactionCreated, TransactionApproved, StatusUpdated). Rejected database triggers as they lose business context (e.g., user intent, reason for change). Follows Martin Fowler Event Sourcing Pattern article. Implementation: src/services/transactionService.ts for event producers, src/events/eventStore.ts for consumer/store logic.