{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-OEy8PJ_xEI2LCwY7U",
"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 problem: updates overwrite previous states, making it impossible to trace history (e.g., who changed status from pending to approved). Alternatives considered: database triggers with a history_logs table were rejected because they only capture row changes without business context (why the change happened, user intent). The chosen approach: store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka, with a materialized view in Postgres for fast frontend reads. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts. Reference architecture: Martin Fowler's 'Event Sourcing Pattern' article. Motivation: compliance requirements demand full history traceability with business context.",
"summary": "The team decided to use Event Sourcing over CRUD in PostgreSQL to maintain a complete audit trail of financial transactions, ensuring compliance can trace all changes with full business context.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1787130012250,
"updated_at": 1787130012250
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 226
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-OEy8PJ_xEI2LCwY7U",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-OEy8PJ_xEI2LCwY7U",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1787130012250
}
}
]
}