{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P1IczJnDFks1AlrdP6n",
"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 financial transaction audit trails.\\n\\nDecision: Move from mutable CRUD tables to immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) stored in Kafka, with a materialized view in Postgres for fast reads.\\n\\nWhy: Database triggers were considered but rejected because they only capture row changes (e.g., status 1 to 2) without business context or user intent. Compliance requires full audit history showing who changed what and why.\\n\\nAlternatives considered:\\n1. history_logs table with database triggers — rejected because triggers lose business context and user intent.\\n2. Event Sourcing with Kafka — selected because it preserves full audit history with domain context.\\n\\nFiles involved:\\n- src/services/transactionService.ts (event producers)\\n- src/events/eventStore.ts (consumer/store logic)\\n\\nReference: Martin Fowler, \"Event Sourcing Pattern\"",
"summary": "Replaced CRUD with Event Sourcing for financial transaction audit trails to preserve business context and satisfy compliance requirements.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1789183391027,
"updated_at": 1789183391027
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 374
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P1IczJnDFks1AlrdP6n",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P1IczJnDFks1AlrdP6n",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1789183391027
}
}
]
}