{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-9ZtkTsIWIAWt86Don",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "Decision made during design discussion to move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. CRUD overwrites previous states, making it impossible to track history (e.g., who changed status from pending to approved). Database triggers were considered but rejected because they only capture row changes without business context (why the change happened or user intent). Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka, with materialized views in Postgres for fast frontend reads. Reference: Martin Fowler's 'Event Sourcing Pattern' article. Code: src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic).",
"summary": "Adopting Event Sourcing over CRUD with Kafka as immutable event log and Postgres materialized views to ensure full audit trail compliance for financial transactions.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,postgres,kafka",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786883841054,
"updated_at": 1786883841054
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 210
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-9ZtkTsIWIAWt86Don",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-9ZtkTsIWIAWt86Don",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786883841054
}
}
]
}