{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P02T9TNxSgiPun_41wY",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "Decision to move from standard CRUD in PostgreSQL to Event Sourcing for financial transaction audit trails. The current CRUD approach overwrites previous states, making it impossible to provide compliance teams with historical change information (e.g., who changed the status from pending to approved for transaction #8821). Alternatives considered: (1) Database triggers with a history_logs table — rejected because triggers only see row changes without business context or user intent. (2) Event Sourcing with Kafka — adopted because it stores immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) preserving full business context. Implementation: event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts. Reference: Martin Fowler's Event Sourcing Pattern article. Kafka stores the immutable event log with a materialized view in Postgres for fast reads.",
"summary": "Adopted Event Sourcing over CRUD with Kafka for immutable audit trails to meet compliance requirements, with Postgres materialized views for read performance.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1787838375832,
"updated_at": 1787838375832
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 311
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P02T9TNxSgiPun_41wY",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P02T9TNxSgiPun_41wY",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1787838375832
}
}
]
}