{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P1WVMr5q4bjQvR2Plup",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard CRUD in PostgreSQL with Event Sourcing for the financial transactions audit trail. The current CRUD approach loses business context when changes occur — database triggers only capture row-level changes (e.g., status 1 to 2) without recording who made the change or why. Under Event Sourcing, all state changes are stored as a sequence of immutable domain events (e.g., TransactionCreated, TransactionApproved, StatusUpdated) in Kafka. A materialized view in PostgreSQL will be built for fast reads on the frontend. Implementation steps: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts. Reference architecture: Martin Fowler's Event Sourcing Pattern. This satisfies compliance requirements by preserving the full history with user intent and business context.",
"summary": "Moving from CRUD to Event Sourcing with Kafka to preserve full audit trail with business context for compliance.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1789416013254,
"updated_at": 1789416013254
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 390
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P1WVMr5q4bjQvR2Plup",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P1WVMr5q4bjQvR2Plup",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1789416013254
}
}
]
}