{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P0FCY_smMB1zBZPteEZ",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"content": "We decided to adopt Event Sourcing instead of standard CRUD in PostgreSQL for financial transaction audit trails. The problem with CRUD is that updates overwrite previous states — when compliance requested the history of transaction #8821, we could not provide who changed the status from pending to approved. An alternative of database triggers with a history_logs table was considered but rejected because triggers only see row changes (e.g., status 1 to 2) and lose business context: they do not capture why a change happened or the user intent behind it. The chosen solution is to store a sequence of immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) using Kafka as the immutable event log, with a materialized view in PostgreSQL for fast reads on the frontend. Reference: Martin Fowler's 'Event Sourcing Pattern' article. Implementation files: src/services/transactionService.ts (event producers) and src/events/eventStore.ts (consumer/store logic).",
"summary": "Adopting Event Sourcing with Kafka for immutable financial transaction audit trails, replacing CRUD, to satisfy compliance requirements for full change history with business context.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,architecture",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1788052126072,
"updated_at": 1788052126072
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 339
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P0FCY_smMB1zBZPteEZ",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P0FCY_smMB1zBZPteEZ",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"depth": 2,
"created_at": 1788052126072
}
}
]
}