{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-5LpJTzHUVqsJQ30XU",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "Decided to move from standard CRUD in PostgreSQL to Event Sourcing pattern to satisfy compliance audit trail requirements. The current CRUD approach overwrites previous states, making it impossible to provide history for transactions (e.g., could not retrieve who changed transaction #8821 from pending to approved). Alternatives considered: (1) database triggers writing to a history_logs table — rejected because business context is lost; triggers only see row changes not user intent behind changes. (2) Event Sourcing — accepted. Implementation plan: use Kafka to store the immutable event log, and build a materialized view in Postgres for fast frontend reads. Event producers will be implemented in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts. Reference architecture: Martin Fowler's Event Sourcing Pattern article.",
"summary": "Adopted Event Sourcing over CRUD using Kafka for immutable event storage and Postgres materialized views to satisfy compliance audit trail requirements.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit,compliance,kafka,postgres",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786813043998,
"updated_at": 1786813043998
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 191
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-5LpJTzHUVqsJQ30XU",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-5LpJTzHUVqsJQ30XU",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786813043998
}
}
]
}