{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons/-P0f_IYV1t7mYtxdx6oI",
"value": {
"topic_path": "lessons",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "Decided to replace standard CRUD in PostgreSQL with Event Sourcing using Kafka for immutable domain event logging, plus a Postgres materialized view for read queries. Motivation: compliance requires full history of state changes including business intent. Alternatives rejected: (1) Standard CRUD — updates overwrite previous states, losing history. (2) Database triggers with a history_logs table — triggers capture row-level changes but lose business context (e.g., why status changed, user intent). Implementation: event producers in src/services/transactionService.ts, consumer/store in src/events/eventStore.ts. Reference: Martin Fowler's Event Sourcing Pattern article.",
"summary": "Adopted Event Sourcing with Kafka for immutable audit trails instead of CRUD or database triggers to preserve business context for compliance.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,crud,postgres,martin-fowler",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1788511336672,
"updated_at": 1788511336672
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 4
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons_-P0f_IYV1t7mYtxdx6oI",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons",
"entry_id": "-P0f_IYV1t7mYtxdx6oI",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1788511336672
}
}
]
}