{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A/lessons|architecture/-OxaV4p6n2__e11fNhjp",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard CRUD in PostgreSQL with Event Sourcing for financial transaction audit compliance.\n\n**Context:** Compliance requires full history of transaction state changes (who changed status from pending to approved and why). Standard CRUD overwrites previous states, losing business context.\n\n**Alternatives considered:**\n- Database triggers with history_logs table — REJECTED because triggers only see row changes (e.g., status 1→2) without business context or user intent.\n- Event Sourcing — ADOPTED. Immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) stored in Kafka, with materialized views in Postgres for fast reads.\n\n**Reference architecture:** Martin Fowler's 'Event Sourcing Pattern' article.\n\n**Implementation files:** src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic).",
"summary": "Adopt Event Sourcing over CRUD for financial transaction audit compliance, using Kafka for immutable events and Postgres materialized views for reads.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgres,financial-transactions",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1784131116359,
"updated_at": 1784131116359
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A",
"value": 6
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A_lessons|architecture_-OxaV4p6n2__e11fNhjp",
"value": {
"address": "0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A",
"topic_path": "lessons/architecture",
"entry_id": "-OxaV4p6n2__e11fNhjp",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1784131116359
}
}
]
}