{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P0xnNU5gy168EQVuang",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"content": "Meeting on 2026-09-07 with Alice (Lead), Bob (Eng), and Charlie (Security). Current design: standard CRUD in PostgreSQL for financial transactions. Problem: updates overwrite previous states; when compliance asked for the history of transaction #8821, the team could not provide who changed the status from pending to approved. Alternative considered: adding a history_logs table with database triggers. Rejected because triggers lose business context—they only see row changes (e.g., status changed from 1 to 2) and do not know why the change happened or the user intent behind it. Decision: Move to Event Sourcing over CRUD. Store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, and build a materialized view in Postgres for fast reads on the frontend. Reference architecture: Martin Fowler's Event Sourcing Pattern article. Implementation locations: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts. Reason: satisfies compliance audit requirements perfectly and is industry standard.",
"summary": "Adopt Event Sourcing with Kafka and Postgres materialized views instead of CRUD with triggers to preserve full audit history and business context for compliance.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit,compliance,postgres,kafka",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1788817016774,
"updated_at": 1788817016774
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 357
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P0xnNU5gy168EQVuang",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P0xnNU5gy168EQVuang",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"depth": 2,
"created_at": 1788817016774
}
}
]
}