{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P0-SdPxFl5ZTt418Xzs",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard CRUD operations in PostgreSQL with Event Sourcing for financial transaction audit trails. The problem was that CRUD updates overwrite previous states, making it impossible to provide compliance with the history of changes (e.g., who changed a transaction status from pending to approved). Database triggers were considered as an alternative but rejected because they only capture row-level changes without business context or user intent. The chosen approach stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka as the immutable event log, with a materialized view in Postgres for fast reads. This follows Martin Fowler's Event Sourcing Pattern. Implementation: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts.",
"summary": "Team adopted Event Sourcing over CRUD with Kafka for immutable audit trails, replacing mutation-overwrite PostgreSQL pattern to satisfy compliance requirements.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1787787908797,
"updated_at": 1787787908797
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 293
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P0-SdPxFl5ZTt418Xzs",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P0-SdPxFl5ZTt418Xzs",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1787787908797
}
}
]
}