ROUTING ARCHITECTURE V2
Ecosistema completo para organización y gestión de contenido con interfaces espaciales
GoGrab Space Routing Architecture V2
Date: November 16, 2025
Status: 🚧 In Progress
Vision: Ferrari/Lambo-level separation of concerns
🎯 Core Philosophy
Widgets consume themes, NOT themes consuming widgets!
The Problem (Old Architecture)
/ui-builder/ux/input ← What is this? Demo? Widget? Design doc? ❌
/ui-builder/themes/ ← Themes mixed with widgets ❌
/ui-builder/ux/text-box ← Routes broken, conceptually confusing ❌
Issues:
- Mixing inspiration with product - UX demos treated as final product
- Wrong dependency - Themes depend on widgets (should be opposite!)
- Unclear purpose - Is it a design guide or builder tool?
- Broken routes - Navigation doesn't match structure
The Solution (New Architecture)
/widgets/ ← Dynamic widget showcase ✅
- Base widgets (from @libs-widgets)
- User-created widgets (from widget-builder)
- All adapt to active theme
/theme/ ← Pure theme system ✅
- guide → How to use themes
- create → Create/edit themes
- templates → Pre-built themes
- editor → Visual theme editor
- NOT widget demos!
/ux/ ← DEPRECATED ⚠️
- Keep as internal design reference
- Extract patterns → convert to widgets
- Don't ship as product
🏗️ New Route Structure
1. /widgets/ - Dynamic Widget Showcase
Purpose: Demonstrate widgets that adapt to ANY theme
// Route Structure
/widgets/ → Widget gallery (all widgets)
/widgets/:widgetId → Dynamic widget demo
/widgets/builder → Widget-builder tool
/widgets/builder/workspace → Create new widget
/widgets/builder/edit/:id → Edit existing widget
Widget Categories:
Base Widgets (from
@libs-widgets/widgets)- button, input, select, checkbox, etc.
- Pre-built, production-ready
- Fully theme-aware
User-Created Widgets (from widget-builder)
- Custom widgets built by space-builders
- Stored per universe/space
- Automatically inherit theme
Key Features:
- ✅ Dynamic routing - One route handles all widgets
- ✅ Theme-agnostic - Widgets adapt to ANY active theme
- ✅ AI-trainable - Widget metadata enables AI generation
- ✅ Flash persistence - Instant save/load
- ✅ Interactive demos - Live configuration playground
Integration with Widget-Builder:
// Widget metadata enables dynamic routing
interface WidgetMetadata {
id: string;
name: string;
category: 'form' | 'content' | 'layout';
demoComponent: Type<any>; // Dynamic component
properties: PropertyGroup[];
themeVariables: string[]; // CSS vars it uses
}
// Route resolver loads correct widget
{
path: ':widgetId',
component: WidgetDemoComponent,
resolve: { widget: WidgetResolver }
}
2. /theme/ - Pure Theme System
Purpose: Theme creation, editing, and documentation (NO widget demos)
// Route Structure
/theme/guide → Complete theme system overview
/theme/create → Create new theme
/theme/templates → Pre-built theme templates
/theme/editor → Visual theme editor
/theme/reference → CSS variable documentation
/theme/best-practices → Design guidelines
/theme/advanced-effects → Glass, neon, 3D effects
Theme System Boundaries:
- ✅ Create themes - Visual editor + AI generation
- ✅ Document themes - CSS variables, utilities
- ✅ Apply themes - Theme picker, storage
- ❌ NO widget demos - That's
/widgets/job! - ❌ NO UI components - Widgets handle their own UI
Theme Components Move Here:
theme-guide.component.tstheme-editor-demo.component.tstheme-picker-demo.component.tstheme-reference-guide.component.tsutility-classes-guide.component.tsadvanced-theme-effects.component.tsgradient-showcase.component.ts
What Stays OUT:
- Widget demos (input, button, select, etc.) →
/widgets/ - Storage demos →
/storage/(if needed) - AI integration →
/ai/(if needed)
3. /ux/ - DEPRECATED (Design Reference)
Purpose: Internal design inspiration (NOT shipped as product)
// Options:
Option A: Redirect to new structure
{ path: 'ux', redirectTo: 'widgets' }
Option B: Keep as internal reference
{
path: 'ux',
component: DesignReferenceComponent,
data: {
warning: 'Internal design reference - not for production'
}
}
Option C: Remove entirely
// Extract patterns → create widgets → delete
Migration Strategy:
- Extract design patterns from each UX demo
- Create base widgets based on those patterns
- Register widgets in widget-builder
- Delete UX demos or mark as deprecated
Example Migration:
// OLD: /ux/input
// Extract patterns: validation, states, accessibility
// Create: InputWidget in @libs-widgets/widgets
// Demo: /widgets/input (dynamic demo)
// OLD CODE (Delete):
libs/libs-ui/demos-lib/src/lib/demos/ux-input/
// NEW CODE (Keep):
libs/libs-widgets/widgets/src/lib/components/input-widget/
🔄 Migration Plan
Phase 1: Create Widget Showcase Route
# 1. Create widget showcase component
nx g @nx/angular:component \
--name=widget-showcase \
--project=widget-showcase \
--standalone
# 2. Create dynamic widget demo component
nx g @nx/angular:component \
--name=widget-demo \
--project=widget-showcase \
--standalone
# 3. Add routes to app.routes.ts
Phase 2: Move Theme Components
# 1. Create theme-showcase library (if needed)
nx g @nx/angular:library theme-showcase \
--directory=libs/theme-system \
--standalone
# 2. Move theme components
# From: libs/libs-ui/demos-lib/src/lib/ux-themes/
# To: libs/theme-system/theme-showcase/
# 3. Update imports and routes
Phase 3: Deprecate UX Routes
# 1. Add deprecation warnings
# 2. Update all navigation links
# 3. Test all routes work
# 4. Remove or redirect /ux/ routes
Phase 4: Widget Extraction
# For each UX demo:
# 1. Analyze design patterns
# 2. Create base widget
# 3. Register in widget-builder
# 4. Create demo in widget-showcase
# 5. Delete UX demo
🎨 Architecture Benefits
1. Clear Separation of Concerns
Widgets = Building blocks (adapt to ANY theme)
Themes = Visual styling (apply to ANY widget)
2. Proper Dependency Flow
CORRECT:
Widget → Consumes → Theme Variables
Theme → Defines → Visual Style
WRONG:
Theme → Depends on → Specific Widget
3. AI-Trainable Patterns
// Widget metadata enables AI understanding
const buttonWidget = {
id: 'button',
category: 'form',
themeVariables: [
'--btn-bg',
'--btn-color',
'--btn-border',
'--btn-hover-bg'
],
properties: [...],
demo: ButtonDemoComponent
};
// AI can:
// 1. Generate new widgets following pattern
// 2. Apply themes to any widget
// 3. Create custom variations
4. Dynamic Routing Scalability
// Add new widget? Just register it!
widgetRegistry.register(newWidget);
// Route automatically available: /widgets/new-widget
// No need to manually add routes
// No need to update navigation
// No need to modify routing files
5. Theme Independence
// Theme system is PURE
// Doesn't care what widgets exist
// Just provides CSS variables
// Any widget can use theme:
.my-custom-widget {
background: var(--ux-surface);
color: var(--ux-text-primary);
border: var(--ux-border);
}
// Works with ANY theme!
📊 Route Comparison
Old Structure (Confusing)
/ui-builder/
├── home
├── ux/ ← What is "ux"?
│ ├── input ← Is this a demo or product?
│ ├── button ← Mixed with widget-builder?
│ ├── text-box ← Broken route!
│ └── menu ← Unclear purpose
├── themes/ ← Themes mixed with widgets
│ ├── guide ← This belongs in themes
│ ├── editor ← This too
│ └── color-showcase ← But not widget demos
└── ai/ ← AI mixed with everything
New Structure (Clear)
/widgets/ ← ALL widgets here
├── (gallery) ← Browse all widgets
├── button ← Dynamic route
├── input ← Dynamic route
├── custom-form ← User-created widget
└── builder/ ← Widget creation tool
├── workspace
└── edit/:id
/theme/ ← PURE theme system
├── guide ← How to use themes
├── create ← Create new theme
├── templates ← Pre-built themes
├── editor ← Visual editor
├── reference ← CSS vars docs
└── advanced-effects ← Special effects
/ai/ ← AI integration (separate)
├── guide
├── tester
└── examples
/ux/ ← DEPRECATED
→ redirectTo: '/widgets'
→ Or: Internal design reference only
🧪 Testing Strategy
1. Widget Route Tests
describe('/widgets/', () => {
it('should load widget gallery');
it('should handle dynamic widget routes');
it('should load widget-builder');
it('should show user-created widgets');
it('should adapt to theme changes');
});
2. Theme Route Tests
describe('/theme/', () => {
it('should load theme guide');
it('should open theme editor');
it('should list theme templates');
it('should NOT show widget demos');
});
3. Integration Tests
describe('Widget + Theme Integration', () => {
it('widget should use theme variables');
it('changing theme should update widget');
it('custom theme should work with all widgets');
it('widget-builder should use current theme');
});
📚 Related Documentation
- Widget Builder Phase 1-4 Complete
- Theme System Architecture
- Module System Architecture
- Storage System
✅ Success Criteria
- Clear Routes: Anyone can understand what each route does
- Theme Independence: Widgets work with ANY theme
- Dynamic Widgets: New widgets auto-available in showcase
- No Confusion: No mixing of concerns
- AI-Ready: Metadata enables AI generation
- Performance: 200% performant theme switching
- Offline-First: Flash persistence everywhere
- Beautiful UX: Ferrari/Lambo-level polish
🚀 Next Steps
- ✅ Document architecture (this file)
- 🔄 Create widget showcase routes
- 🔄 Move theme components to /theme/
- 🔄 Deprecate /ux/ routes
- 🔄 Extract widget patterns
- 🔄 Test integration
- 🔄 Update navigation
- 🔄 Document patterns
Let's build the Ferrari/Lambo of platform builders! 🏎️💨