{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-5a4IQBzTzEkh9nAF2",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to use Event Sourcing instead of standard CRUD in PostgreSQL for financial transaction audit trails, to ensure compliance. Problem: CRUD overwrites previous states, making it impossible to provide audit history (e.g., who changed transaction #8821 status from pending to approved). Alternative considered: database triggers with a history_logs table — rejected because triggers only see row changes (status 1 to 2) and lose business context (why the change happened, user intent). Solution: Store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka, with a materialized view in Postgres for fast reads. Files: src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic). Reference: Martin Fowler's 'Event Sourcing Pattern' article. Decision made by Alice (Lead), Bob (Eng), Charlie (Security).",
"summary": "Decided to use Event Sourcing with Kafka instead of CRUD or database triggers for financial transaction audit trails, ensuring compliance and preserving business context.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,financial",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786817041627,
"updated_at": 1786817041627
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 194
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-5a4IQBzTzEkh9nAF2",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-5a4IQBzTzEkh9nAF2",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786817041627
}
}
]
}