{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-AZqNdQaMn606KS62Q",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team discussed database strategy for financial transactions to ensure compliance. Currently using standard CRUD in PostgreSQL, which overwrites previous states and loses business context (e.g., who changed status from pending to approved). Alternatives considered: (1) history_logs table with database triggers — rejected because triggers only see row changes without knowing why the change happened or user intent. (2) Event Sourcing — adopted. Instead of storing current state in a mutable table, store a sequence of immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) using Kafka for the immutable event log, with materialized views in Postgres for fast reads. Following Martin Fowler's Event Sourcing Pattern article. Code involved: src/services/transactionService.ts (event producers), src/events/eventStore.ts (consumer/store logic).",
"summary": "The team decided to adopt Event Sourcing instead of CRUD for financial transactions, using Kafka for immutable event logging and Postgres materialized views for reads, to satisfy compliance audit requirements.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,financial-transactions,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786900604457,
"updated_at": 1786900604457
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 219
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-AZqNdQaMn606KS62Q",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-AZqNdQaMn606KS62Q",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786900604457
}
}
]
}