{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OxOsO1hvoTkKY_Orxlw",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"content": "Decision: Adopt Event Sourcing instead of mutable CRUD for financial transactions to satisfy compliance audit requirements. The team identified that standard CRUD operations in PostgreSQL overwrite previous states, making it impossible to provide the history of changes (e.g., who changed transaction status from pending to approved). Alternative considered: Database triggers writing to a history_logs table. Rejected because triggers only capture row-level changes without business context or user intent behind the change. Chosen approach: Event Sourcing with immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) stored in Kafka as the event log, with a materialized view in Postgres for fast frontend reads. 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.",
"summary": "Replaced mutable CRUD with Event Sourcing for financial transactions to provide full audit trails. Kafka stores immutable domain events while Postgres serves materialized views for reads.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql,domain-events",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1783919382701,
"updated_at": 1783919382701
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 36
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OxOsO1hvoTkKY_Orxlw",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OxOsO1hvoTkKY_Orxlw",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"depth": 2,
"created_at": 1783919382701
}
}
]
}