{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OxsaBSpkwn6bmTIywkB",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"content": "The team decided to replace the current CRUD pattern in PostgreSQL with Event Sourcing for financial transaction audit trails. Problem: CRUD updates overwrite previous states, making it impossible to trace who changed transaction statuses (e.g., status changed from pending to approved). Alternative considered: Database triggers and a history_logs table. Rejected because business context is lost — triggers only see row changes, not the user intent or reason for the change. Decision: Use Kafka to store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated), and build a materialized view in Postgres for fast reads on the frontend. Reference architecture: Martin Fowler's Event Sourcing Pattern article. Implementation: Event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.",
"summary": "Adopt Event Sourcing with Kafka and Postgres materialized views to meet compliance audit requirements, replacing the existing CRUD pattern that loses business context on updates.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,financial-transactions,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1784434706293,
"updated_at": 1784434706293
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 53
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OxsaBSpkwn6bmTIywkB",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OxsaBSpkwn6bmTIywkB",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"depth": 2,
"created_at": 1784434706293
}
}
]
}