{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-Oy_AS1bblmVZD5nmVTT",
"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. Current CRUD updates overwrite previous states, making it impossible to provide compliance history (e.g., who changed transaction #8821 from pending to approved). Database triggers were considered but rejected because they lack business context -- they only see row changes, not the user intent behind them. The decision is to use Kafka to store an immutable event log (TransactionCreated, TransactionApproved, StatusUpdated) and build a materialized view in Postgres for fast reads. The implementation involves event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts. The design follows Martin Fowler's Event Sourcing Pattern article.",
"summary": "Adopted Event Sourcing over CRUD with Kafka for immutable audit trails of financial transactions, using Postgres materialized views for reads.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1785182671015,
"updated_at": 1785182671015
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 80
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-Oy_AS1bblmVZD5nmVTT",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-Oy_AS1bblmVZD5nmVTT",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1785182671015
}
}
]
}