{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-Oxp41MMV5fqV3yV3wFf",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard CRUD operations in PostgreSQL with Event Sourcing using Kafka as the immutable event log, with a materialized view in Postgres for fast reads. This decision was driven by compliance requirements for audit trails — specifically, the need to retain full business context (who changed what and why) rather than just tracking row-level changes. Database triggers were considered but rejected because they lose business context (e.g., a trigger only sees status changed from 1 to 2, not the user's intent). Standard CRUD was rejected because updates overwrite previous states, making history unavailable. The implementation will use event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts. This follows Martin Fowler's 'Event Sourcing Pattern' article as the reference architecture.",
"summary": "Adopted Event Sourcing over CRUD and database triggers to retain full business context in audit trails for financial transactions, using Kafka for immutable event storage and Postgres materialized views for fast reads.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1784375682519,
"updated_at": 1784375682519
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 51
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-Oxp41MMV5fqV3yV3wFf",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-Oxp41MMV5fqV3yV3wFf",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1784375682519
}
}
]
}