{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-AWR-Y5ZL1Xje2QRIM",
"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, but updates overwrite previous states, making audit trails impossible (e.g., compliance could not determine who changed transaction #8821 status from pending to approved). Alternatives considered: (1) history_logs table with database triggers — rejected because triggers only see row changes without business context or user intent. (2) Event Sourcing — adopted. Instead of storing current state in mutable tables, store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka, with materialized views in Postgres for fast reads. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts. Reference: Martin Fowler's Event Sourcing Pattern article.",
"summary": "Team decided to implement Event Sourcing with Kafka instead of CRUD with triggers for financial transaction audit trails, following Martin Fowler's pattern.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786899709987,
"updated_at": 1786899709987
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 216
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-AWR-Y5ZL1Xje2QRIM",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-AWR-Y5ZL1Xje2QRIM",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786899709987
}
}
]
}