{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-CRnJlAKO4fa8o-4-r",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to migrate from standard CRUD in PostgreSQL to an Event Sourcing pattern for financial transaction audit trails. The current CRUD approach overwrites previous states, making it impossible to reconstruct the history of changes (e.g., who changed transaction #8821 from pending to approved and why). Alternatives considered: (1) Adding a history_logs table with database triggers - rejected because triggers only capture row-level changes but lose business context like user intent. (2) Event Sourcing with Kafka as the immutable event log - adopted. Domain events like TransactionCreated, TransactionApproved, and StatusUpdated are stored immutably, with materialized views in Postgres for fast frontend reads. Reference: Martin Fowler's Event Sourcing Pattern article. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.",
"summary": "Adopted Event Sourcing over CRUD with Kafka for financial transaction audit trails to meet compliance requirements.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql,architecture",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786932049201,
"updated_at": 1786932049201
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 224
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-CRnJlAKO4fa8o-4-r",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-CRnJlAKO4fa8o-4-r",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786932049201
}
}
]
}