Architecture: How should generated platforms perform CRUD operations again...
Documentation for Sessions
🏗️ Architecture: How should generated platforms perform CRUD operations again...
Date: 2026-03-12
Time: 03:11:17 UTC
Session: gspace1-206.4
Agent: backend
Confidence: 97%
Status: ✅ Documented
📋 Decision Context
Question:
How should generated platforms perform CRUD operations against the backend?
Task: S206: Wire generated platforms to real backend CRUD via all 4 APIs
🎯 Decision Made
Chosen:
Generated services extend
UniverseDataCrudService(new adapter in template) which wraps gspace1's existingUniverseDataService. Data flows: Component → composable → UniverseDataCrudService → UniverseDataService → backend-api:3000 → MongoDB (space_{spaceId} DB, universe_{universeId}_{collection} collections). Schemas auto-registered by BackendSetupPhase.
Options Considered:
- Raw HttpClient with hardcoded /api/{entities} URLs (S199-S204 approach — wrong backend)
- Extend BaseCrudApiService from gmodules1 (mock-api pattern, not real backend)
- Use UniverseDataService directly in each generated service (verbose, not composable-compatible)
- UniverseDataCrudService adapter that maps composable types to UniverseDataService types (chosen)
💭 Reasoning
S199-S204 generated repositories used raw HttpClient with /api/{{entities}} which hit wrong endpoints (no space/universe context). gmodules1's BaseCrudApiService used mock-api, not our real backend. UniverseDataService already exists in gspace1 with full CRUD, caching, offline support, optimistic updates — but its types (QueryFilter, PaginatedResponse) differ from the composable types (PaginationRequest, CrudPaginatedResult). The adapter maps between them, giving composable compatibility while using the real data layer. The data path: backend-api has UniverseDataController with multi-tenant isolation per space/universe. BackendSetupPhase auto-registers entity schemas + creates MongoDB indexes after generation. No new backend work needed.
📁 Files Involved
libs/core/module-base/src/lib/crud/universe-crud-api.service.tslibs/libs-foundational/core-angular/src/lib/services/universe-data.service.tsAPIs/backend-ai-api/src/app/workflow/templates/template-registry.service.ts
🔗 Related
- Decision ID:
dev_1773285077543_oja5n0g - Session: 206
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation