Architecture: How should generated platforms initialize space/universe con...
Documentation for Sessions
🏗️ Architecture: How should generated platforms initialize space/universe con...
Date: 2026-03-12
Time: 03:11:28 UTC
Session: gspace1-206.5
Agent: angular
Confidence: 93%
Status: ✅ Documented
📋 Decision Context
Question:
How should generated platforms initialize space/universe context for UniverseDataService to work?
Task: S206: Wire UniverseDataService context from environment.ts in generated platforms
🎯 Decision Made
Chosen:
PlatformBootstrapService + providePlatformBootstrap() provider function. Seeds both SpaceService (via new seedForPlatform method) and UniverseContextService (via existing setSpaceContext + setUniverse) at APP_INITIALIZER time from environment.ts static config.
Options Considered:
- Route guards (how gspace1 does it — requires spaceGuard + universeResolver infrastructure)
- APP_INITIALIZER that reads environment.ts and seeds services (chosen — simplest for generated platforms)
- Hardcode spaceId/universeId in each service (violates DRY, not configurable)
💭 Reasoning
In gspace1, SpaceService and UniverseContextService are populated by route guards (spaceGuard, universeResolver) which depend on URL-based routing (/:spaceSlug/universe/:universeId/...). Generated platforms have a single fixed space+universe (determined at generation time), so this complex routing infra is unnecessary. The bootstrap provider reads from environment.ts (which the app-shell-generator populates with the real spaceId/universeId from the generation request) and calls the existing setter methods. UniverseDataService.currentSpaceId reads from SpaceService.currentSpace()?.id, so we added seedForPlatform() to SpaceService in the template copy. UniverseDataService.currentUniverseId reads from UniverseContextService.universeId() which is set via the existing setUniverse() method.
📁 Files Involved
libs/libs-foundational/core-angular/src/lib/services/platform-bootstrap.service.tslibs/libs-foundational/core-angular/src/lib/services/space.service.tsAPIs/backend-vitto-api/src/app/module-generation/generators/app-shell-generator.service.ts
🔗 Related
- Decision ID:
dev_1773285088786_1cwmxzn - Session: 206
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation