{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P1I8iB32AR2p1JO-fOk",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"content": "Design decision to replace standard CRUD operations in PostgreSQL with Event Sourcing for financial transaction audit trails. The problem: CRUD overwrites previous states, making it impossible to provide compliance officers with a full history of who changed what and why (e.g., transaction #8821 status change from pending to approved). Alternatives considered: (1) Database triggers writing to a history_logs table — rejected because business context is lost; triggers only see row-level changes (status 1→2) without knowing the user intent or reason. (2) Event Sourcing — chosen approach. Store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka as the event log, then build materialized views in PostgreSQL for fast frontend reads. This preserves full audit context including user intent. Reference: Martin Fowler's 'Event Sourcing Pattern' article. Implementation files: src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic).",
"summary": "Adopt Event Sourcing with Kafka for immutable financial transaction audit trails, replacing CRUD in PostgreSQL. Materialized views in Postgres serve frontend reads. This ensures full compliance audit history with business context preserved.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql,financial-transactions",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1789175194372,
"updated_at": 1789175194372
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 372
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P1I8iB32AR2p1JO-fOk",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P1I8iB32AR2p1JO-fOk",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"depth": 2,
"created_at": 1789175194372
}
}
]
}