{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-VOg5nSoeqxKRWBEsg",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Audit Trails",
"content": "The team decided to adopt Event Sourcing instead of standard CRUD for financial transaction audit trails to ensure compliance. The current CRUD approach in PostgreSQL overwrites previous states and cannot provide change history (e.g., compliance could not trace who changed transaction #8821 from pending to approved). Database triggers were considered as an alternative but were rejected because they lose business context — triggers only see row-level changes (e.g., status changed from 1 to 2) and do not capture user intent or the reason behind the change. The chosen approach stores a sequence of immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) via Kafka as the event log, with materialized views built in Postgres for fast frontend reads. The design follows Martin Fowler's Event Sourcing Pattern article. Implementation assignments: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts.",
"summary": "Adopted Event Sourcing over CRUD using Kafka-based immutable event log and Postgres materialized views to satisfy financial compliance audit requirements, following Martin Fowler's Event Sourcing Pattern.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit,compliance,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1787250000307,
"updated_at": 1787250000307
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 235
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-VOg5nSoeqxKRWBEsg",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-VOg5nSoeqxKRWBEsg",
"title": "Event Sourcing over CRUD for Financial Audit Trails",
"depth": 2,
"created_at": 1787250000307
}
}
]
}