Architectural Decisions - Refreshed November 2025

Updated decisions matrix for modular-universe, space-map, and widget/module taxonomy

✅ Architectural Decisions - Refreshed November 2025

Last Updated: November 14, 2025
Status: 🎯 ACTIVE DECISIONS
Purpose: Definitive record of architectural decisions after deep platform analysis


🎯 EXECUTIVE SUMMARY

After comprehensive analysis of the current platform state, we have confirmed and refined critical architectural decisions that will guide development forward.

Key Insight: The previous CRITICAL-DECISIONS-REQUIRED.md was partially outdated. Many decisions have already been implemented, while others require refinement based on current platform capabilities.


📋 DECISION MATRIX

Decision 1: Space-Map vs Modular-Universe ✅ CONFIRMED

Original Question: Fix space-map or replace with modular-universe?

DECISION: DUAL-TRACK APPROACH ⭐

Rationale:

Implementation Strategy:

TRACK 1: space-map-lib (Legacy/Navigation)
Purpose: Universe navigation, detail views, analytics
Status: Maintain and enhance gradually
Routes: /space/:spaceSlug/space-map/* (existing)
Components:
  - space-overview.component.ts
  - universe-detail.component.ts
  - galaxy-detail.component.ts
  - world-detail.component.ts
  - universe-analytics.component.ts

TRACK 2: modular-universe (Builder/Grid)
Purpose: Visual grid-based universe/galaxy construction
Status: Continue rapid development (primary focus)
Routes: /space/:spaceSlug/modular-universe/* (new)
Components:
  - modular-universe-builder.component.ts
  - grid-canvas.component.ts
  - section-config-panel.component.ts
  - module-connection-system.component.ts

Integration Points:

  1. space-map links to modular-universe for "Edit Structure" actions
  2. modular-universe saves layouts that space-map navigates/displays
  3. Both consume UniversalModuleService for module data
  4. Both use @storage-system for persistence

Migration Path:

Status: ✅ IMPLEMENTED - Both libraries active and complementary


Decision 2: UI Builder Restructure ✅ OPTION A CONFIRMED

Original Question: Showcase vs Widget Builder vs Deprecate?

DECISION: SPLIT INTO TWO LIBRARIES (OPTION A) ⭐

Implementation:

CURRENT:
libs/libs-ui/ui-builder/ (Mixed purpose, broken routes)

SPLIT INTO:

1. libs/libs-ui/widget-showcase/
   Purpose: Documentation and showcase of existing widgets
   Features:
     - Interactive examples
     - Code snippets
     - Visual variant selector
     - Theme integration examples
   Routes: /space/:spaceSlug/widgets/showcase
   Status: TO BE CREATED

2. libs/libs-structural/widget-builder/
   Purpose: Visual tool to CREATE new widgets
   Features:
     - Visual widget composer
     - Property/IO panel
     - Variant creator
     - Live preview
     - Export as component
   Routes: /space/:spaceSlug/widgets/builder
   Status: TO BE CREATED

3. Theme Components → libs/theme-system/theme-components/
   Purpose: Theme-specific UI components
   Status: TO BE MIGRATED

Rationale:

Status: ⏳ PENDING IMPLEMENTATION - Documented and approved


Decision 3: Widget vs Module Boundary 🆕 HYBRID APPROACH

Original Question: Which elements should stay as widgets vs become modules?

DECISION: FUNCTIONAL PROGRESSION MODEL ⭐

Core Principle:

Widget (Pure UI) + Functionality (Flows/Logic) = Module (Reusable System)

Decision Matrix:

Component Type Classification When to Promote Example
Input Fields Widget When bound to flows/validation <gg-input> → user-input-module (with validation flow)
Select Dropdowns Widget When managing complex data sources <gg-select> → data-select-module (with API flow)
Buttons Widget When triggering multi-step flows <gg-button> → action-button-module (with flow)
Cards Widget When containing modules <gg-card> → content-card-module
Modals Module (always) Immediate Complex lifecycle + state
Sidebars Module (always) Immediate Navigation + state management
Navigation Module (always) Immediate Routing + state
Data Grids Module (always) Immediate State + pagination + sorting
Forms (simple) Widget When validation/submission added <gg-form> → smart-form-module
Forms (complex) Module (always) Immediate Multi-step + business logic

Promotion Criteria:

A widget should be promoted to a module when it gains ANY of:

  1. ✅ Singularity Integration - Attached to logic blocks or flows
  2. ✅ Lifecycle Management - Needs onInit/onDestroy hooks with business logic
  3. ✅ State Management - Complex internal state beyond UI
  4. ✅ Routing - Has its own routes or navigation
  5. ✅ Children Management - Contains other modules
  6. ✅ Backend Integration - Direct API calls beyond simple data binding

Implementation Guidelines:

// WIDGET: Pure UI with @Input/@Output
@Component({
  selector: 'gg-input',
  standalone: true,
  inputs: ['value', 'placeholder', 'disabled'],
  outputs: ['valueChange', 'blur', 'focus']
})
export class GgInputWidget {
  // Pure presentation, no business logic
}

// MODULE: Widget + Functionality
@Component({
  selector: 'gg-smart-input',
  standalone: true
})
export class SmartInputModule implements BrowserModuleContract {
  readonly manifest: ModuleManifest = {
    id: 'smart-input',
    name: 'Smart Input',
    actions: ['validate', 'transform', 'submit'],
    flows: ['validation-flow', 'submission-flow']
  };
  
  // Business logic, flow integration, validation
  async validate() { /* ... */ }
  async submit() { /* ... */ }
}

Storage Strategy:

Status: ✅ DOCUMENTED - Ready for implementation


Decision 4: Grid vs Flexbox Strategy ✅ ALREADY IMPLEMENTED

Original Question: CSS Grid only, Flexbox only, or both?

DECISION: HYBRID - BOTH IMPLEMENTED ⭐

Current Implementation:

// Already implemented in grid-canvas.component.ts
interface LayoutConfiguration {
  type: 'flexbox' | 'grid';
  
  flexbox?: {
    direction: 'row' | 'column';
    wrap: 'nowrap' | 'wrap';
    justifyContent: string;
    alignItems: string;
    gap: string;
  };
  
  grid?: {
    rows: string[];
    columns: string[];
    gap: string;
  };
  
  sections: SectionConfig[];
}

Features Implemented:

Platform Export:

Status: ✅ FULLY IMPLEMENTED - Working and tested


Decision 5: Canvas Cutting Mechanic ✅ PARTIALLY IMPLEMENTED

Original Question: Divider lines vs drag-to-split vs templates?

DECISION: TOOLBAR + MODE SYSTEM (IMPLEMENTED) ⭐

Current Implementation:

// Mode system implemented in grid-canvas.component.ts
type CanvasMode = 'select' | 'add' | 'resize' | 'reorder';

// Current features:
- ✅ Mode toolbar
- ✅ Add section mode
- ✅ Resize mode with handles
- ✅ Reorder mode with drag-drop
- ✅ Select mode for configuration

What's Implemented:

  1. ✅ Canvas modes (select, add, resize, reorder)
  2. ✅ Section creation (addSection method)
  3. ✅ Section resizing (startResize, resizeSection methods)
  4. ✅ Section reordering (drag-drop with CDK)
  5. ✅ Section configuration panel integration

What's Needed (Cutting Mechanic Vision):

  1. ⏳ Visual divider lines (draggable horizontal/vertical)
  2. ⏳ Canvas "cutting" UX (drag dividers to slice)
  3. ⏳ Auto-section generation from divider positions
  4. ⏳ Template presets (header/content/footer, sidebar layouts)

Enhancement Strategy:

// Proposed addition:
type CanvasMode = 'select' | 'add' | 'resize' | 'reorder' | 'divide';

// New features:
- Add 'divide' mode
- Draggable divider lines (horizontal/vertical)
- On confirm: Calculate sections from divider positions
- Generate CSS Grid from dividers
- Each section auto-becomes sub-module

Status: ✅ FOUNDATION IMPLEMENTED - Needs cutting mechanic enhancement


🏗️ ARCHITECTURE ALIGNMENT

Current Platform State

Working Systems:

  1. ✅ Universal Module System - UniversalModuleService operational
  2. ✅ Module Registry - ModuleRegistryService with manifests
  3. ✅ Storage System - Flash persistence + backend sync
  4. ✅ Grid Canvas - Flexbox/Grid builder working
  5. ✅ Section Configuration - Tabbed panel with module browser
  6. ✅ Theme System - CSS variables, modern design
  7. ✅ Module Browser - Visual selection with access control

Libraries Status:

Library Location Status Purpose
modular-universe libs/libs-structural/ ✅ Active Development Grid-based builder (PRIMARY)
space-map libs/libs-structural/ ✅ Maintained Navigation/analytics (LEGACY)
singularity libs/libs-structural/ ✅ Operational Logic blocks + flows
editor-web-lib libs/libs-structural/ ✅ Operational Page editor
modularity-lib libs/libs-structural/ ✅ Needs Enhancement Module creation wizard
ui-builder libs/libs-ui/ ⚠️ Broken Routes Needs split (Decision 2)
widget-showcase - ⏳ To Create Showcase library
widget-builder - ⏳ To Create Creation tool

🔄 INTEGRATION STRATEGY

How Components Work Together

┌─────────────────────────────────────────────────────────────┐
│ SPACE BUILDER WORKFLOW                                      │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│ 1. CREATE UNIVERSE (Dashboard)                              │
│    ↓                                                         │
│ 2. STRUCTURE GRID (modular-universe)                        │
│    - Define layout (flexbox/grid)                           │
│    - Add/resize/reorder sections                            │
│    - Each section = sub-module                              │
│    ↓                                                         │
│ 3. ASSIGN CONTENT (section-config-panel)                    │
│    - Browse modules (module-browser)                        │
│    - Assign to sections                                     │
│    - Configure behaviors                                    │
│    ↓                                                         │
│ 4. BUILD PAGES (editor-web-lib)                             │
│    - Visual page editor                                     │
│    - Widget placement                                       │
│    - Content management                                     │
│    ↓                                                         │
│ 5. ADD LOGIC (singularity)                                  │
│    - Create logic blocks                                    │
│    - Build flows                                            │
│    - Attach to modules/widgets                              │
│    ↓                                                         │
│ 6. CREATE MODULES (modularity-lib)                          │
│    - Package reusable modules                               │
│    - Configure manifests                                    │
│    - Export for reuse                                       │
│    ↓                                                         │
│ 7. PREVIEW (launch-station)                                 │
│    - Test universe                                          │
│    - Device preview                                         │
│    - Quality check                                          │
│    ↓                                                         │
│ 8. DEPLOY (launch-station)                                  │
│    - Deploy to production                                   │
│    - Configure domain                                       │
│    - Go live                                                │
│    ↓                                                         │
│ 9. MANAGE (space-management)                                │
│    - Monitor deployed universe                              │
│    - View analytics                                         │
│    - Manage data                                            │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Module Communication Flow

// Storage Layer
@storage-system (flash-persistence + backend)
  ↓
// Service Layer
UniversalModuleService (CRUD operations)
ModuleRegistryService (manifests)
  ↓
// Component Layer
modular-universe-builder → grid-canvas → section-config-panel
  ↓                            ↓              ↓
space-map (navigation)    editor-web    singularity
  ↓
// Output Layer
launch-station (preview/deploy)
space-management (analytics)

📊 IMPLEMENTATION PRIORITY

Phase 1: Foundation (Weeks 1-2) ✅ MOSTLY COMPLETE

Phase 2: Builders (Weeks 3-4) ⏳ NEXT

Phase 3: Cutting Mechanic (Weeks 5-6) 📋 PLANNED

Phase 4: Integration (Weeks 7-8) 📋 PLANNED

Phase 5: Polish (Weeks 9-12) 📋 FUTURE


🎯 SUCCESS CRITERIA

Technical

User Experience

Platform Goals


📚 RELATED DOCUMENTS


Status: ✅ DECISIONS CONFIRMED
Next Action: Proceed with Phase 2 implementation
Owner: Development Team
Last Updated: November 14, 2025