{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OxaM-fLtgdYOcjjs2Bu",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "The team decided to replace standard CRUD in PostgreSQL with Event Sourcing for financial transaction audit trails. The current CRUD approach overwrites previous states on UPDATE, making it impossible to provide compliance with historical change data (e.g., who changed transaction #8821 from pending to approved). Database triggers were considered but rejected because they lack business context - triggers only see row-level changes (e.g., status 1 to 2) without knowing why the change happened or user intent. The agreed approach: store immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) in Kafka, and build a materialized view in Postgres for fast frontend reads. This follows Martin Fowler's 'Event Sourcing Pattern' article. Implementation: Bob will build event producers in src/services/transactionService.ts and consumer/store logic in src/events/eventStore.ts.",
"summary": "Replaced CRUD with Event Sourcing (Kafka + Postgres materialized views) for financial transaction audit trails, following Martin Fowler's Event Sourcing Pattern. Rejects database triggers due to lack of business context.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql,crud",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1784128735958,
"updated_at": 1784128735958
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 40
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OxaM-fLtgdYOcjjs2Bu",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OxaM-fLtgdYOcjjs2Bu",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1784128735958
}
}
]
}