{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-3TJDEePoIGvZSVoOn",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard CRUD operations in PostgreSQL with Event Sourcing for financial transaction audit trails to meet compliance requirements. Database triggers on a history_logs table were considered but rejected because they lose business context — triggers only see row changes (e.g., status 1 to 2) without capturing why the change happened or user intent. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka, with a materialized view in Postgres for fast frontend reads. This approach was informed by Martin Fowler's 'Event Sourcing Pattern' article. Implementation will produce events in src/services/transactionService.ts and consume/store them in src/events/eventStore.ts.",
"summary": "Replaced CRUD with Event Sourcing for financial transaction audit trails to meet compliance requirements for complete change history with business context.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,compliance,audit-trail,financial-transactions",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786781451151,
"updated_at": 1786781451151
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 178
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-3TJDEePoIGvZSVoOn",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-3TJDEePoIGvZSVoOn",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786781451151
}
}
]
}