{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-lDhWTWBHQOrP5Y3t1",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to adopt Event Sourcing instead of standard CRUD in PostgreSQL for financial transaction audit trails. The primary driver was compliance: current CRUD overwrites previous states, making it impossible to reconstruct who changed transaction #8821 from pending to approved. Alternative approaches considered: (1) Database triggers writing to a history_logs table - rejected because triggers lose business context (they see row changes like status 1 to 2 but not user intent or why the change happened). (2) Event Sourcing - chosen. Immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) are stored via Kafka as the event log. A materialized view in Postgres provides fast reads for the frontend. This follows Martin Fowler Event Sourcing Pattern. Implementation: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts.",
"summary": "Adopt Event Sourcing with Kafka for immutable financial transaction audit trails, replacing CRUD to satisfy compliance requirements for full change history and business context.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit,compliance,kafka,postgres,architecture",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1787532335198,
"updated_at": 1787532335198
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 274
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-lDhWTWBHQOrP5Y3t1",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-lDhWTWBHQOrP5Y3t1",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1787532335198
}
}
]
}