{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OyaztZvE6MVw_JXhfcv",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to move from standard CRUD operations in PostgreSQL to Event Sourcing using Kafka for financial transaction audit trails. Instead of storing mutable current state, we store a sequence of immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated). Database triggers were considered but rejected because they lose business context — a trigger only sees row changes without knowing why the change happened or the user intent behind it. Kafka stores the immutable event log, and a materialized view in Postgres provides fast reads for the frontend. Implementation involves src/services/transactionService.ts (event producers) and src/events/eventStore.ts (consumer/store logic). This decision was informed by Martin Fowler's Event Sourcing Pattern article.",
"summary": "Replaced PostgreSQL CRUD with Event Sourcing over Kafka to provide immutable audit trails for financial transactions, satisfying compliance requirements.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1785213196603,
"updated_at": 1785213196603
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 81
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OyaztZvE6MVw_JXhfcv",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OyaztZvE6MVw_JXhfcv",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1785213196603
}
}
]
}