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 existing UniverseDataService. Data flows: Component → composable → UniverseDataCrudService → UniverseDataService → backend-api:3000 → MongoDB (space_{spaceId} DB, universe_{universeId}_{collection} collections). Schemas auto-registered by BackendSetupPhase.

Options Considered:

    1. Raw HttpClient with hardcoded /api/{entities} URLs (S199-S204 approach — wrong backend)
    1. Extend BaseCrudApiService from gmodules1 (mock-api pattern, not real backend)
    1. Use UniverseDataService directly in each generated service (verbose, not composable-compatible)
    1. 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


🔗 Related


Auto-generated by MCP Smart Consolidation