{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P-4BRoIr_1kZVYuhZQh",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard CRUD operations in PostgreSQL with Event Sourcing using Kafka for the audit trail of financial transactions. The motivation was that CRUD overwrites previous states, making it impossible to reconstruct the history of changes (e.g., who changed a transaction status from pending to approved). Database triggers with a history_logs table were considered but rejected because they only capture row changes without business context or user intent. Event Sourcing stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, with a materialized view in Postgres for fast frontend reads. This follows Martin Fowler's Event Sourcing Pattern. Implementation: event producers in src/services/transactionService.ts, consumer/store logic in src/events/eventStore.ts.",
"summary": "Replaced CRUD with Event Sourcing using Kafka for financial transaction audit trails to comply with audit requirements and preserve business context.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1786793544979,
"updated_at": 1786793544979
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 185
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P-4BRoIr_1kZVYuhZQh",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P-4BRoIr_1kZVYuhZQh",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1786793544979
}
}
]
}