{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P0lqVxLuCCVQjgdchYO",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "We decided to replace standard CRUD in PostgreSQL with Event Sourcing to satisfy compliance requirements for financial transaction audit trails. Instead of mutating current state, we now store an immutable sequence of domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, and build a materialized view in Postgres for fast frontend reads. This was chosen over database triggers because triggers lose business context—they only see row changes and cannot capture user intent or the reason behind state changes. Implementation will be in src/services/transactionService.ts (event producers) and src/events/eventStore.ts (consumer/store). Reference architecture: Martin Fowler's 'Event Sourcing Pattern' article.",
"summary": "Adopt Event Sourcing with Kafka and Postgres materialized views instead of CRUD to preserve full audit history and business context for financial transactions, as required by compliance.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1788616511318,
"updated_at": 1788616511318
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 351
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P0lqVxLuCCVQjgdchYO",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P0lqVxLuCCVQjgdchYO",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1788616511318
}
}
]
}