{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OyTPAzCeY-Pz5rxeALB",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. CRUD updates overwrite previous states, making it impossible to provide compliance history (e.g., who changed transaction #8821 from pending to approved). Database triggers were considered but rejected because they lose business context — they see row changes but not why the change happened or user intent. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) instead of mutable state. Kafka will store the immutable event log, with a materialized view in Postgres for fast reads. This follows Martin Fowler Event Sourcing Pattern article. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.",
"summary": "Moved financial transaction audit trail from CRUD to Event Sourcing using Kafka for immutable event storage and Postgres materialized views, satisfying compliance with full change history.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,crud,kafka,postgres,compliance,martin-fowler",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1785069092813,
"updated_at": 1785069092813
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 64
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OyTPAzCeY-Pz5rxeALB",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OyTPAzCeY-Pz5rxeALB",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1785069092813
}
}
]
}