{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-76_q2pq3PJj0VfiUu",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. The problem was that CRUD updates overwrite previous states, making it impossible to provide compliance with historical change information (e.g., who changed transaction #8821's status from pending to approved). Database triggers were considered but rejected because they lose business context — a trigger sees row changes (status changed from 1 to 2) but doesn't know why the change happened or the user intent behind it. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) using Kafka, with a materialized view in Postgres for fast frontend reads. Martin Fowler's 'Event Sourcing Pattern' article is the reference architecture. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.",
"summary": "Moved from CRUD to Event Sourcing for financial transaction audit compliance, using Kafka event log with Postgres materialized views, preserving business context that triggers couldn't capture.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,financial",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786842602883,
"updated_at": 1786842602883
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 199
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-76_q2pq3PJj0VfiUu",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-76_q2pq3PJj0VfiUu",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786842602883
}
}
]
}