{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A/lessons|architecture/-OzrHIX2-Zqff6p87rj4",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard PostgreSQL CRUD operations with Event Sourcing for financial transaction audit trails. The current CRUD approach loses historical state and cannot answer compliance queries about who changed a transaction's status and why. Alternatives like database triggers were considered but rejected because they lack business context (e.g., they see status changes but not the user intent). The chosen solution: store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, and build materialized Postgres views for fast reads. Martin Fowler's 'Event Sourcing Pattern' article was cited as the reference architecture. Implementation will involve producers in src/services/transactionService.ts and consumers/stores in src/events/eventStore.ts.",
"summary": "Switching from PostgreSQL CRUD to Event Sourcing with Kafka for immutable audit trails, using materialized views for reads.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,kafka,postgres,compliance",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786560198787,
"updated_at": 1786560198787
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A",
"value": "[object Object]11111"
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A_lessons|architecture_-OzrHIX2-Zqff6p87rj4",
"value": {
"address": "0x1F9b7b3c342602A93D6E22C62C4aE3Ba7ac91f4A",
"topic_path": "lessons/architecture",
"entry_id": "-OzrHIX2-Zqff6p87rj4",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786560198787
}
}
]
}