{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OvXpTcQScgh4uBvCVNj",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"content": "DECISION: Move from standard CRUD in PostgreSQL to Event Sourcing for financial transactions.\n\nPROBLEM: Standard CRUD overwrites previous states. When compliance requested the history of transaction #8821, the team could not provide who changed the status from pending to approved.\n\nALTERNATIVES CONSIDERED:\n1. Database triggers on a history_logs table — REJECTED because business context is lost. A trigger only sees row changes (e.g., status changed from 1 to 2), it doesn't know why the change happened or the user intent behind it.\n\nCHOSEN APPROACH: Event Sourcing with Kafka. Store a sequence of immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in an immutable event log via Kafka. Build a materialized view in PostgreSQL for fast reads on the frontend.\n\nFILES AFFECTED:\n- src/services/transactionService.ts — event producers\n- src/events/eventStore.ts — consumer and store logic\n\nREFERENCE: Martin Fowler's 'Event Sourcing Pattern' article.",
"summary": "The team chose Event Sourcing with Kafka over standard CRUD and database triggers for financial transaction audit trails to satisfy compliance requirements for full history tracking.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,kafka,financial-transactions,compliance,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1781922130459,
"updated_at": 1781922130459
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 13
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OvXpTcQScgh4uBvCVNj",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OvXpTcQScgh4uBvCVNj",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"depth": 2,
"created_at": 1781922130459
}
}
]
}