src/main/data/README.md
This directory contains the main process data management implementation.
src/main/data/
├── api/ # Data API framework
│ ├── core/ # ApiServer, MiddlewareEngine, adapters
│ └── handlers/ # API endpoint implementations
├── services/ # Business logic layer (see services/README.md)
│ └── utils/ # Row → Entity mapping utilities (see utils/README.md)
├── db/ # Database layer
│ ├── schemas/ # Drizzle table definitions
│ ├── seeding/ # Database initialization
│ └── DbService.ts # Database connection management
├── migration/ # Data migration system
├── CacheService.ts # Cache management
├── DataApiService.ts # API coordination
├── PreferenceService.ts # User preferences
└── dataApiDataChange.ts # DataApi data change notification (post-commit broadcast)
notifyDataApiDataChange(effects) is the single publish point for cross-window data convergence: after a business write successfully commits, the owning data service states which read models changed (DataApiDataChangeEffect[]), and the signal is broadcast to all windows. This is a strictly fenced exception to the "no side effects in data services" rule — see Fenced Exception: Data Change Notification for the fences, and the notifier's own doc comment for publish invariants (post-commit timing, *Tx() never notifies, no-op writes may skip) and the delivery contract.
It deliberately lives at the data/ top level, NOT in api/ — api/ is the portable transport framework (HttpAdapter reserved), while this capability is an Electron/IPC special case depending on WindowManager.
@shared/data/api/schemas/api/handlers/services/repositories/ (if complex domain)# Generate migrations
yarn db:migrations:generate