{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A/lessons|architecture/-P0qg8SbOJykSOacgAWf",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "Decision: Move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. Why: Updates overwrite previous state; compliance could not trace who changed transaction #8821 from pending to approved. Database triggers were considered but rejected because they only capture row changes (e.g., status 1->2) and lose business context/user intent. Solution: Store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, and build a materialized view in Postgres for fast frontend reads. Files involved: src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic). Reference: Martin Fowler's 'Event Sourcing Pattern' article.",
"summary": "Adopt Event Sourcing with Kafka and Postgres materialized views to satisfy financial audit compliance and preserve business context lost with CRUD/triggers.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit,compliance,kafka,postgres,crud",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1788697679719,
"updated_at": 1788697679719
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A",
"value": "[object Object]1111111111111111"
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A_lessons|architecture_-P0qg8SbOJykSOacgAWf",
"value": {
"address": "0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A",
"topic_path": "lessons/architecture",
"entry_id": "-P0qg8SbOJykSOacgAWf",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1788697679719
}
}
]
}