{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OvFeZ3zaqyumKUyXQQH",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. WHY: Updates in the current CRUD system overwrite previous states, making it impossible to provide compliance with the history of who changed what and when (e.g., transaction #8821 status change from pending to approved). ALTERNATIVES CONSIDERED: Database triggers to write to a history_logs table on every UPDATE — rejected because triggers lose business context. A trigger just sees row changes and does not know why the change happened or the user intent behind it. DECISION: Event Sourcing using Kafka to store the immutable event log with Postgres materialized views for fast reads. REFERENCE: Martin Fowler's 'Event Sourcing Pattern' article — industry standard for audit requirements. FILES: src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic).",
"summary": "Adopt Event Sourcing over the current CRUD approach for financial transaction audit trails — using Kafka for the immutable event log and Postgres materialized views for reads — to satisfy compliance requirements while preserving full business context and user intent.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,kafka,postgres,audit-trail,compliance,crud",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1781617279295,
"updated_at": 1781617279295
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 2
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OvFeZ3zaqyumKUyXQQH",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OvFeZ3zaqyumKUyXQQH",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1781617279295
}
}
]
}