{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P1BQ18fqTi6nOw2DVmV",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "Decision context from design meeting (2026-09-10): The team decided to replace standard CRUD in PostgreSQL with Event Sourcing to satisfy compliance/audit trail requirements. Current CRUD overwrites previous states, making it impossible to reconstruct the history of a transaction (e.g., who changed status from pending to approved). Database triggers were considered but rejected because they only see row changes (1 to 2) without capturing business context or user intent. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, with a materialized view in Postgres for fast reads. Implementation files: src/services/transactionService.ts (event producers) and src/events/eventStore.ts (consumer/store logic). Reference: Martin Fowler's Event Sourcing Pattern article.",
"summary": "Switched from CRUD to Event Sourcing with Kafka for immutable audit trails, addressing compliance gaps where triggers failed to capture business context.",
"depth": 2,
"tags": "lesson_learned,EventSourcing,CRUD,AuditTrail,Compliance,Kafka,PostgreSQL",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1789062292075,
"updated_at": 1789062292075
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 361
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P1BQ18fqTi6nOw2DVmV",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P1BQ18fqTi6nOw2DVmV",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1789062292075
}
}
]
}