{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-QjHrfslTcvP0l_IZA",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to use Event Sourcing instead of standard CRUD in PostgreSQL for financial transaction audit trails. The problem with CRUD is that updates overwrite previous states, making it impossible to track history of state changes (e.g., who changed status from pending to approved). The alternative of database triggers was considered but rejected because triggers only capture row changes without business context - they don't know why the change happened or the user intent behind it. With Event Sourcing, immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) are stored via Kafka, and a materialized view in Postgres is built for fast frontend reads. The team is following Martin Fowler's 'Event Sourcing Pattern' article as reference architecture. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.",
"summary": "Adopted Event Sourcing over CRUD to maintain full audit trail with business context for compliance requirements, using Kafka for immutable event storage and Postgres materialized views for read performance.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1787171778027,
"updated_at": 1787171778027
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 232
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-QjHrfslTcvP0l_IZA",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-QjHrfslTcvP0l_IZA",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1787171778027
}
}
]
}