COMPLETE ARCHITECTURE ANALYSIS
Ecosistema completo para organización y gestión de contenido con interfaces espaciales
GoGrab Space - Complete Architecture Analysis
Date: October 28, 2025
Purpose: Comprehensive mapping of all systems before final reorganization
Status: 🔄 IN PROGRESS
1. NX Libraries Inventory (40+ Libraries)
Core Infrastructure Libraries
1.1 Storage & Persistence
storage-system(194 files)- Purpose: Unified intelligent storage with Flash Persistence
- Key Features: OPFS, IndexedDB, localStorage, AI optimization, Firebase sync
- Three-Tier Architecture: Global, Space, Private (TO ANALYZE)
- Key Exports:
autoFlashState,FlashStateService,GgStorage - Flash Persistence: NGXS replacement with signals
core-angular(58 files)- Purpose: Core Angular services and components
- Key Services: SpaceService, UniverseContextService, UnifiedNavigationService, UserHistoryService
- Components: ContextBreadcrumb, PageSelectorModal
- Status: Contains UniversalAssetRegistryService
1.2 Models & Types
core-models(76 files)- Purpose: Complete type system for entire platform
- Key Types: Widget, WidgetDefinition, Space, Universe, Galaxy, World, Module, Flow
- Widget Types: ComponentInput, ComponentOutput interfaces exist
- TO ANALYZE: Complete widget I/O system
api-contracts(6 files)- Purpose: Shared contracts between frontend and backend
- Status: TO ANALYZE
1.3 Module System
module-system(13 files)- Purpose: Module registry and manifest system
- Key: ModuleRegistryService, ModuleManifest
- Status: Core of modularity
Platform Tools (Main Features)
2.1 Editor System
editor-ui(96 files)- Purpose: Core editor components and services
- Key Components: EditorUiComponent, PropertiesPanelNewComponent, WidgetTreeComponent
- Key Services: EditorService, LayoutService, DragDropService
- Status: Needs Module/Flow insertion capability
editor-web-lib(72 files)- Purpose: Web-specific editor features
- Routes: editor.routes.ts
- Components: EditorWorkspaceComponent, ExecutionLogsComponent
- Issue: Had
/widgetsroute that was removed
2.2 Widget System
widgets(236 files)- Purpose: Widget definitions, factories, and manager
- Key Components: WidgetLibraryComponent, EditorCanvasComponent, ButtonWidget
- Key Services: WidgetRegistryService, WidgetModuleLoaderService, WidgetsManagerService
- Widget Manager: Space-scoped at
/space/widgets - Status: Recently unified, variants working
demos-lib(21 files)- Purpose: Unified widget registry
- Key Service: WidgetRegistryService (NEW unified one)
- Status: Global registry for all widgets
2.3 Singularity (Logic Builder)
singularity-lib(124 files)- Purpose: Visual logic builder, database integration
- Key Components: LogicBuilderComponent, FlowComposerComponent
- TO ANALYZE: Flow types, how flows connect to pages
- Status: Space-scoped (reusable across universes)
2.4 Modularity (Module Packager)
modularity-lib(52 files)- Purpose: Package pages + flows into modules
- Key Components: ModuleBuilderComponent (4-tab workflow)
- Status: Space-scoped (reusable across universes)
- TO ANALYZE: Module structure, export/import
2.5 Space Map (Universe Management)
space-map-lib(119 files)- Purpose: 3D universe visualization and management
- Key Components: SpaceOverviewComponent, UniverseDetailComponent, GalaxyDetailComponent
- Routes: space-map.routes.ts
- Status: Universe-scoped
2.6 Launch Station (Deployment)
launch-station-lib(10 files)- Purpose: Deploy universes
- Key Components: LaunchDashboardComponent
- Issue: Shows "No Universes" - data disconnect
- Status: Needs data integration fix
UI/UX Libraries
3.1 Design System
theme-system(193 files)- Purpose: Complete theme system
- Features: Utility classes, color system, animations
ux-ui-core(82 files)- Purpose: Core UI components
ux-ui-extended(56 files)- Purpose: Extended UI components
ux-ui-forms(40 files)- Purpose: Form components
ux-ui-feedback(30 files)- Purpose: Feedback components (toast, alerts)
shared-ui(56 files)- Purpose: Shared UI components
3.2 Component Libraries
ux-menu(37 files)ux-panel(28 files)ux-portal(34 files)ux-loading(35 files)ux-space(27 files)ux-top-nav(24 files)ux-icons(29 files)ux-icon-finder(16 files)
3.3 Testing & Development
ux-test-lib(71 files)- Purpose: Component showcase and testing
- Routes: TO ANALYZE - this is the UI builder mentioned
- Status: Contains widget demos and showcases
dev-tools(8 files)- Purpose: Development utilities
Specialized Libraries
4.1 AI & Intelligence
gograb-ai(176 files)- Purpose: AI integration across platform
- Features: AI-powered generation, suggestions
- TO ANALYZE: How AI connects to widgets/flows/modules
ai-data-connector(9 files)- Purpose: AI data integration
4.2 Visual & Animation
flash-animations(39 files)- Purpose: Animation system
cosmic-backgrounds(27 files)- Purpose: Space-themed backgrounds
smart-canvas(46 files)- Purpose: Smart canvas functionality
universal-visual-compositor(38 files)- Purpose: Visual composition
scroll-trigger(64 files)- Purpose: Scroll-based animations
react-to-scroll(20 files)svg-connections(18 files)- Purpose: Visual connections between elements
4.3 Backend & Security
backend-core(4 files)- Purpose: Backend utilities
core/security(48 files)- Purpose: Auth guards, permissions, roles
auth-ui(17 files)- Purpose: Authentication UI components
4.4 Other Specialized
prompt-system(44 files)- Purpose: TO ANALYZE
landing-page-ui(18 files)catalyst-ui-kit(138 files)- Purpose: Component kit
component-library(6 files)
2. Storage System - Three-Tier Architecture
Flash Persistence Core (autoFlashState)
- Location:
libs/storage-system/src/flash/helpers/auto-flash-state.ts - Purpose: Zero-config persistent signals
- Usage:
const myState = autoFlashState('key', defaultValue); - Features:
- Automatic discovery and registration
- Pre-loading for critical states
- On-demand loading for everything else
- State versioning and migrations
- Global registry:
AUTO_DISCOVERED_STATES
Three-Tier Data Model (CONCEPTUAL - NEEDS IMPLEMENTATION)
Currently, storage is namespaced by key prefixes:
space_*→ Space-level datauniverse_*→ Universe-specific datapage-*,flow-*,widget-*→ Resource-specific data
RECOMMENDATION: Implement explicit GgStorage namespaces:
// Global tier (shared across all spaces)
storage.global.put('widget-templates', templates);
// Space tier (shared across all universes in a space)
storage.space(spaceId).put('custom-widgets', widgets);
// Private tier (universe-specific)
storage.private(universeId).put('draft-pages', pages);
Backend Sync Points
- Backend API:
apis/backend-api/src/app/app.module.ts - MongoDB Collections:
- Users (AuthModule)
- Universes (UniversesModule)
- Assets (AssetsModule)
- AI Conversations (AIModule)
- Sync Strategy: Frontend uses IndexedDB/OPFS, periodic background sync to MongoDB
3. Widget Input/Output System
ComponentInput Interface
// libs/core-models/src/lib/types/component.types.ts
export interface ComponentInput {
name: string;
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'any';
description?: string;
default?: any;
required?: boolean;
validator?: string; // JSON schema or function string
}
ComponentOutput Interface
export interface ComponentOutput {
name: string;
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'any';
description?: string;
}
UXFrameworkInput/Output (for advanced widgets)
// libs/core-models/src/lib/types/widget-generation.types.ts
export interface UXFrameworkInput {
name: string;
type: string;
required: boolean;
defaultValue?: any;
description: string;
}
export interface UXFrameworkOutput {
name: string;
type: string;
description: string;
}
Current State: NOT YET CONNECTED
- Widgets have
inputsandoutputsdefined - Singularity flows exist but are NOT attached to pages yet
- CRITICAL GAP: No mechanism to pipe flow outputs into widget inputs
What Needs to Be Built:
FlowAttachmentService- Attach flows to pagesDataPipelineService- Route flow outputs to widget inputsWidgetDataBinding- Subscribe widgets to data sources- Editor UI - Panel to connect flows to widgets
4. Backend API Structure
Modules
// apis/backend-api/src/app/app.module.ts
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true }),
MongooseModule.forRootAsync({ ... }), // MongoDB
ThrottlerModule.forRoot([...]), // Rate limiting
AuthModule, // JWT auth, user management
AIModule, // AI generation, completions
StorageModule, // S3/storage integration
UniversesModule, // Universe CRUD, deployment
AssetsModule, // Asset management
]
})
MongoDB Collections (Inferred)
users- User accountsuniverses- Deployed universesassets- Uploaded filesai_conversations- AI interaction history- MISSING:
pages,flows,modules,widgets
API Endpoints (Need to Verify)
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/profilePOST /api/auth/logoutPOST /api/ai/*- AI generationGET /api/universes- List universesPOST /api/universes- Create universe- NEEDED: CRUD for pages, flows, modules, widgets
JSON Export/Import Endpoints (NOT IMPLEMENTED)
RECOMMENDATION: Add these endpoints:
POST /api/modules/export- Export module as JSONPOST /api/modules/import- Import module from JSONPOST /api/widgets/export- Export widget as JSONPOST /api/widgets/import- Import widget from JSONPOST /api/flows/export- Export flow as JSONPOST /api/flows/import- Import flow from JSON
5. UI Builder (/ux-test routes)
Purpose
Component showcase and testing environment, NOT the main Editor.
Route Structure
// apps/gograb-space/src/app/ui-builder/ui-builder.routes.ts
/ux-test
/home → Component Development Hub
/ux/widgets → Widget demos (button, input, menu, etc.)
/themes → Theme system showcase
/editor → Theme Designer
/picker-demo → Theme Picker
/utility-classes → 17 utility files
/ai → AI integration guide and tester
/storage-inspector → Storage debugging
/smart-canvas → Smart canvas demo
Key Difference from Editor
- UI Builder: Showcase existing components
- Editor (
@editor-web-lib): Build pages with drag-and-drop
Integration with Main System
- Theme system developed here, used in Editor
- Component demos inform widget design
- Storage inspector helps debug
GgStorage
6. JSON Export/Import System
Current State: PARTIALLY IMPLEMENTED
Module Export (Modularity)
// libs/modularity-lib/src/lib/types/module-config.types.ts
export interface ModuleExport {
config: ModuleConfig;
pages: any[]; // Full page data
flows: any[]; // Full flow data
exportedAt: string;
exportVersion: string;
}
Widget Export (Editor)
// Editor's onSave() and onExport() methods create JSON blobs
const exportData = {
page: currentPage,
exportedAt: new Date(),
};
const blob = new Blob([JSON.stringify(exportData, null, 2)]);
// Downloads as .json file
Flow Export (Singularity)
// libs/singularity-lib/src/lib/services/flow-export.service.ts
// libs/singularity-lib/src/lib/models/exported-flow.interface.ts
What's Missing
- Unified Export Format - Different systems use different JSON structures
- Import Mechanisms - Can export, but no UI to import
- Vibe Coding Integration - No "paste JSON to create" workflow
- Backend Storage - Exports download to disk, not saved to backend
Recommendation: Unified Export System
interface UnifiedExport {
type: 'widget' | 'page' | 'flow' | 'module' | 'universe';
id: string;
name: string;
version: string;
data: any; // Type-specific data
dependencies: { type: string; id: string; }[]; // What this needs
metadata: {
exportedAt: string;
exportedBy: string;
platform: 'gograb-space';
platformVersion: string;
};
}
7. Dashboard Requirements
Current Dashboard (g-space-dashboard.component.ts)
// Signals
readonly userHistory = this.userHistoryService.userHistory;
readonly currentUser = this.authService.user;
readonly universes = this._universesSignal.asReadonly();
readonly hasUniverses = computed(() => this.universes().length > 0);
readonly publishedUniversesCount = computed(() => ...);
readonly draftUniversesCount = computed(() => ...);
readonly showWelcomeFlow = computed(() => ...);
// Features
- User history tracking
- Universe quick access
- Feature cards (Editor, Singularity, Modularity, etc.)
- Welcome flow for first-time users
What Should Be Added
Space-Level Analytics:
- Total pages across all universes
- Total flows created
- Total widgets built
- Storage usage
- AI tokens used
Cross-Universe Insights:
- Most used widgets
- Most reused modules
- Popular flows
- Recently modified assets
Quick Actions:
- Create new universe
- Create new page (with universe selector)
- Create new flow
- Create new widget
Visual Data:
- Universe status cards (draft/deployed)
- Timeline of recent activity
- Universe thumbnails/previews
8. Complete Route Mapping
Current Route Structure
Main App (apps/gograb-space/src/app/app.routes.ts)
/ → /landing
/landing → Landing page
/auth/* → Authentication routes
/dashboard → Main dashboard (g-space-dashboard)
/universe/create → Universe creation wizard
/ux-test/* → UI Builder (component showcase)
/editor/* → Editor routes (from @editor-web-lib)
/space-map/* → Space Map routes (from @space-map-lib)
/singularity/* → Singularity routes (from @singularity-lib)
/modularity/* → Modularity routes (from @modularity-lib)
/launch-station/* → Launch Station routes (from @launch-station-lib)
/space/widgets → Widgets Manager routes (from @widgets)
Editor Routes (libs/editor-web-lib/src/lib/editor.routes.ts)
/editor
/:universeIdentifier/workspace → Main editor workspace
/:universeIdentifier/pages → Page management
(REMOVED: /:universeIdentifier/widgets)
Proposed New Structure (from gograb-space-route-architecture.plan.md)
Space-Scoped (Reusable):
/space/:spaceSlug → Space overview
/space/:spaceSlug/widgets → Widgets Manager
/space/:spaceSlug/singularity → Singularity
/space/:spaceSlug/modularity → Modularity
/space/:spaceSlug/settings → Space settings
Universe-Scoped (Specific):
/space/:spaceSlug/:universeId → Universe overview (3D space-map)
/space/:spaceSlug/:universeId/editor → Editor (galaxy/world selector)
/space/:spaceSlug/:universeId/editor/:galaxyId → Editor for galaxy
/space/:spaceSlug/:universeId/editor/:galaxyId/:worldId → Edit specific page
/space/:spaceSlug/:universeId/launch → Launch/Deploy
/space/:spaceSlug/:universeId/settings → Universe settings
/space/:spaceSlug/:universeId/:galaxyId → Galaxy settings
Deployed Universes (Subdomains):
universe-slug.gograb.space/ → Deployed universe
Migration Path
- Add space-slug resolution (auto-select if user has one space)
- Create route guards:
SpaceAutoSelectGuard,UniverseContextGuard - Update all tool routes to be relative to space/universe
- Add redirects from old routes
- Update all navigation links
9. Data Flow Diagrams
1. Widget Creation → Registration → Usage Flow
[User] → [Widgets Manager (/space/widgets)]
↓
[Create Widget] → Save to storage (space_custom-widgets)
↓
[WidgetModuleLoaderService] loads all widget modules
↓
[WidgetRegistryService (@demos-lib)] registers widget
↓
[Widget appears in Editor] → widget-library.component.ts
↓
[User drags widget to canvas]
↓
[EditorService] adds widget to page.widgets[]
↓
[Flash Persistence] auto-saves to storage (pages_state)
↓
[Backend Sync] (eventual) → MongoDB
2. Module Creation → Packaging → Deployment Flow
[User] → [Modularity (/modularity)]
↓
[Tab 1: Select Pages] → Browse Editor pages
[Tab 2: Select Flows] → Browse Singularity flows
[Tab 3: Map Routes] → Define module routes
[Tab 4: Review & Deploy] → Preview + Deploy
↓
[ModuleConfig created] → Saved to storage
↓
[Build Process] → Packages pages + flows
↓
[ModuleManifest generated] → Registered with @module-system
↓
[Module available in Editor] → Can be inserted into pages
↓
[Launch Station] → Deploy to subdomain or custom domain
3. Flow Creation → Attachment → Execution Flow
[User] → [Singularity (/singularity)]
↓
[Create Flow] → Visual node editor
↓
[Flow saved] → storage (space_flows)
↓
(MISSING STEP) [Attach flow to page] → Editor needs FlowAttachmentPanel
↓
(MISSING STEP) [Map flow outputs to widget inputs] → DataPipelineService
↓
(MISSING STEP) [Runtime execution] → FlowExecutionEngine
↓
(MISSING STEP) [Widget receives data] → Updates UI
4. Universe Creation → Editing → Deployment Flow
[User] → [Dashboard] → "Create Universe" button
↓
[Universe Creation Wizard] (/universe/create)
↓
[Universe created] → Saved to storage (universe_*)
↓
[Space Map] (/space-map) → Visualize universe
↓
[Create Galaxies] → Organizational containers
↓
[Create Pages] → Jump to Editor
↓
[Editor] → Build pages with widgets + modules + flows
↓
[Modularity] → Package pages into modules
↓
[Launch Station] → Deploy universe
↓
[Deployed to subdomain] → universe-slug.gograb.space
10. Critical Missing Connections
1. Launch Station Data Disconnect
Problem: Launch Station shows "No Universes" despite universes existing
Root Cause: Launch Station doesn't use UniverseManagerService or SpaceService
Fix: Inject UnifiedDataService (to be created) and load universes
2. Flow → Page Attachment
Problem: No way to attach Singularity flows to Editor pages
Root Cause: Missing FlowAttachmentService and Editor UI
Fix: Create service + UI panel
3. Flow → Widget Data Pipeline
Problem: Flows exist, widgets exist, but they can't communicate
Root Cause: Missing DataPipelineService and WidgetDataBinding
Fix: Create runtime data flow system
4. Module → Editor Integration
Problem: Can't insert packaged modules into Editor
Root Cause: Editor only accepts widgets, not modules
Fix: Create ModuleInserterComponent and ModuleInstance type
5. Universe/Galaxy → Editor Navigation
Problem: Can't jump from Space Map to Editor with context
Root Cause: No "Edit in Editor" buttons with proper routing
Fix: Add buttons with context-aware navigation
11. Implementation Priority
Phase 1: Data Unification (CRITICAL - 2-3 days)
Problem: Each tool maintains its own data, no single source of truth
Solution: Create UnifiedDataService
// libs/core-angular/src/lib/services/unified-data.service.ts
@Injectable({ providedIn: 'root' })
export class UnifiedDataService {
// Signals
readonly spaces = signal<Space[]>([]);
readonly universes = signal<Universe[]>([]);
readonly pages = signal<World[]>([]);
readonly flows = signal<Flow[]>([]);
readonly modules = signal<Module[]>([]);
readonly widgets = signal<SpaceWidget[]>([]);
// Computed cross-references
readonly universesWithContent = computed(() => { ... });
readonly modulesWithAssets = computed(() => { ... });
// Load everything for a space
async loadSpaceData(spaceSlug: string): Promise<void> { ... }
}
Phase 2: Flow → Page Connection (HIGH - 2-3 days)
Components to Create:
FlowAttachmentServiceFlowAttachmentPanelComponent(Editor UI)- Update
Worldinterface to includeattachedFlowIds: string[]
Phase 3: Widget I/O + Data Pipeline (HIGH - 3-4 days)
Components to Create:
DataPipelineServiceWidgetDataBindinginterfaceFlowExecutionEngine(if doesn't exist)- Update widgets to subscribe to data sources
Phase 4: Module → Editor Integration (MEDIUM - 2-3 days)
Components to Create:
ModuleInserterComponentModuleInstancetypeModuleZoneComponent(render modules on canvas)- Update
EditorServiceto handle module instances
Phase 5: Route Reorganization (MEDIUM - 2-3 days)
Implementation:
- Create space-first routing
- Add route guards
- Update all navigation
- Add redirects
Phase 6: Editor Enhancements (LOW - 2-3 days)
Components to Create:
- Module Inserter panel (sidebar tab)
- Flow Inserter panel (sidebar tab)
- "Edit in Editor" buttons in Space Map
Phase 7: JSON Export/Import Unification (LOW - 2-3 days)
Implementation:
- Unified export format
- Import UI components
- Backend endpoints
- Vibe coding workflow
NEXT STEPS
Based on this analysis, the implementation should follow this order:
- ✅ Create UnifiedDataService - Single source of truth
- ✅ Fix Launch Station - Connect to unified data
- ✅ Add Flow Attachment - Connect Singularity to Editor
- ✅ Build Data Pipeline - Widget I/O + flow execution
- ✅ Module Integration - Insert modules in Editor
- ✅ Route Reorganization - Space-first architecture
- ✅ Editor Enhancements - Module/Flow inserters
- ✅ Export/Import System - Unified JSON workflow
Status: Analysis COMPLETE ✅
Ready for: Implementation Planning