{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-3TG-LfCL4REQzZM2K",
"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. CRUD overwrites previous states, preventing compliance from retrieving historical state changes (e.g., who changed transaction #8821 from pending to approved). Database triggers were considered but rejected because they only capture row changes without business context or user intent. The solution uses Kafka to store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) with a materialized view in Postgres for fast frontend reads. Implementation in src/services/transactionService.ts (event producers) and src/events/eventStore.ts (consumer/store logic). Reference: Martin Fowler's Event Sourcing Pattern article.",
"summary": "Adopted Event Sourcing over CRUD for financial transaction audit trails, using Kafka for immutable event logs and Postgres materialized views for reads, ensuring compliance-ready history tracking.",
"depth": 2,
"tags": "lesson_learned,Event Sourcing,Audit Trail,Compliance,Kafka,PostgreSQL",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786781437974,
"updated_at": 1786781437974
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 177
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-3TG-LfCL4REQzZM2K",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-3TG-LfCL4REQzZM2K",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786781437974
}
}
]
}