Comprehensive Platform Restructuring Plan

Complete plan to fix routing, navigation, guest mode, and user journey

🏗️ Comprehensive Platform Restructuring Plan

Date: October 29, 2025
Status: 🔴 CRITICAL - IMMEDIATE ACTION REQUIRED
Priority: P0 - Foundation is broken, must fix before adding features


🚨 Critical Issues Identified

Issue #1: Navigation Structures are Repetitive

Problem:

Impact: Confusing UX, maintenance nightmare

Solution: Consolidate to exactly 2 navigation structures:

  1. Global Navigation - Platform-wide features (docs, internal tools, settings)
  2. Space Navigation - Space-specific modules (dynamically registered)

Issue #2: Runtime Error in Navigation

Error:

ERROR RuntimeError: NG04008: The requested path contains undefined segment at index 0
at validateCommands (router2.mjs:6078:13)
at _Router.navigate (router2.mjs:5972:5)
at _MainLayoutComponent.onNavigate (main-layout.component.ts:205:17)

Problem: Navigation paths have undefined segments Root Cause: Routes not properly constructed with space slug Solution: Fix route construction in navigation builder


Issue #3: Initial Landing Flow is Wrong

Current Behavior:

Expected Behavior:


Issue #4: No Guest/Demo Mode

Problem: Users must register before testing the platform

Requirement: Allow users to explore WITHOUT registration:


Issue #5: ModularityRoutes Not Being Used

Problem:

Impact: Modularity features inaccessible

Solution: Integrate ModularityRoutes into manifest


Issue #6: Missing Context-Aware Navigation

Problem: Platform doesn't adapt based on user's state

Example:

Solution: Implement intelligent guards that check context


Issue #7: No User Journey Tracking

Problem: No way to track where user came from or what they've completed

Examples Needed:

Solution: Create UserJourneyTrackerService with manifest pattern


Issue #8: Widget System is Dispersed

Problem: Widgets scattered across multiple libraries:

Solution: Consolidate widget architecture


Issue #9: No User Permissions System

Problem: No role-based access control

Requirements:

Solution: Implement permissions based on @user-management module


Issue #10: Landing Editor Not Integrated

Problem: Landing editor exists in @editor-web-lib but not properly used

Location: libs/editor-web-lib/src/lib/components/landing-editor/

Solution: Integrate landing editor into proper routing flow


🎯 Complete User Journey Flow

Phase 1: First Visit (Unregistered)

User → http://localhost:5200/
  ↓
Redirect to /landing
  ↓
Landing page shows:
  - Platform overview
  - Key features
  - "Try it FREE" button (no registration required)
  - "Sign Up" button
  - "Log In" button

Phase 2: Guest Mode (Testing)

User clicks "Try it FREE"
  ↓
System generates:
  - tempUserId: temp-{uuid}
  - tempSpaceSlug: temp-{uuid}
  ↓
Redirect to /temp-{uuid}/dashboard
  ↓
User can:
  - Create universes (temp data)
  - Build pages (temp data)
  - Test all features
  ↓
Banner shows: "You're in demo mode. Sign up to save your work!"

Phase 3: Registration (Converting Guest)

User clicks "Sign Up" from demo
  ↓
Registration form
  ↓
Upon successful registration:
  1. Create real userId
  2. Create real spaceId
  3. Transfer ALL temp data to real account
  4. Update analytics (temp → real conversion)
  ↓
Redirect to /{spaceSlug}/dashboard

Phase 4: Regular User Flow

Registered user logs in
  ↓
Check if user has spaces:
  - NO spaces → Create first space wizard
  - Has spaces → Redirect to last used space
  ↓
/{spaceSlug}/dashboard
  ↓
User navigates to tools:
  - /{spaceSlug}/editor
  - /{spaceSlug}/space-map
  - /{spaceSlug}/singularity
  - /{spaceSlug}/modularity
  - etc.

🔄 Context-Aware Navigation Logic

Smart Redirects Based on State

Example 1: User navigates to Editor without Universe

User → /{spaceSlug}/editor
  ↓
Guard checks: Does space have universes?
  - NO → Redirect to /universe/create (with returnUrl: /editor)
  - YES → Show editor

Example 2: User navigates to Space Map

User → /{spaceSlug}/space-map
  ↓
Guard checks: Does space have universes?
  - NO → Show "Create your first universe" UI
  - YES → Show universe navigation map

Example 3: Direct Universe URL

User → /{spaceSlug}/{universeSlug}/editor
  ↓
Guard checks:
  1. Does space exist? → NO → /landing
  2. Does universe exist? → NO → /{spaceSlug}/universe/create
  3. Does user have access? → NO → /forbidden
  ↓
All checks pass → Show editor for that universe

🧭 User Journey Tracker Service

Architecture

@Injectable({ providedIn: 'root' })
export class UserJourneyTrackerService {
  // State tracking (using @storage-system)
  private journeyState = autoFlashState<UserJourneyState>('user-journey', {
    userId: null,
    currentSpace: null,
    navigationHistory: [],
    completedSteps: [],
    returnUrls: {},
    analytics: {}
  });

  // Public methods
  trackNavigation(from: string, to: string): void;
  hasCompletedStep(step: string): boolean;
  setReturnUrl(context: string, url: string): void;
  getReturnUrl(context: string): string | null;
  recordCompletion(step: string): void;
  
  // Analytics
  getConversionRate(): number; // temp → real users
  getAverageJourneyTime(): number;
  getMostVisitedRoutes(): string[];
}

Completion Steps Tracking

const JOURNEY_STEPS = {
  // Onboarding
  'visited-landing': 'User visited landing page',
  'started-demo': 'User started demo mode',
  'registered': 'User created account',
  
  // Universe Setup
  'created-universe': 'User created first universe',
  'added-galaxy': 'Universe has galaxies',
  'configured-structure': 'Universe structure configured',
  
  // Building
  'created-page': 'User created first page',
  'added-widget': 'User added first widget',
  'configured-nav': 'User configured navigation',
  'added-sidebar': 'User added sidebar',
  'added-topnav': 'User added top nav',
  
  // Advanced
  'created-flow': 'User created Singularity flow',
  'created-module': 'User created custom module',
  'deployed': 'User deployed to production'
};

📋 Implementation Plan

Phase 1: Fix Critical Errors (2-3 hours) - P0

Tasks:

  1. ✅ Fix navigation error (undefined segment)
  2. ✅ Consolidate navigation structures
  3. ✅ Integrate ModularityRoutes
  4. ✅ Fix initial landing flow

Deliverables:


Phase 2: Guest Mode Implementation (4-6 hours) - P0

Tasks:

  1. ✅ Create GuestAuthService
  2. ✅ Generate temp IDs (tempUserId, tempSpaceSlug)
  3. ✅ Modify authGuard to allow guests
  4. ✅ Add data transfer mechanism (temp → real)
  5. ✅ Add demo mode banner
  6. ✅ Update analytics tracking

Deliverables:


Phase 3: Context-Aware Navigation (3-4 hours) - P1

Tasks:

  1. ✅ Create UniverseGuard (checks if universe exists)
  2. ✅ Create ContextAwareGuard (smart redirects)
  3. ✅ Implement returnUrl mechanism
  4. ✅ Update all route guards

Deliverables:


Phase 4: User Journey Tracker (4-5 hours) - P1

Tasks:

  1. ✅ Create UserJourneyTrackerService
  2. ✅ Implement state persistence (using @storage-system)
  3. ✅ Add completion tracking
  4. ✅ Add returnUrl management
  5. ✅ Add analytics methods
  6. ✅ Create JourneyTrackerManifest (follow module pattern)

Deliverables:


Phase 5: User Permissions System (6-8 hours) - P2

Tasks:

  1. ✅ Study @user-management module
  2. ✅ Design permission model
  3. ✅ Implement PermissionsService
  4. ✅ Add role-based guards
  5. ✅ Add space collaboration
  6. ✅ Update UI (show/hide based on permissions)

Deliverables:


Phase 6: Widget System Consolidation (8-10 hours) - P2

Tasks:

  1. ✅ Audit all widget locations
  2. ✅ Design unified widget architecture
  3. ✅ Migrate widgets to @widgets library
  4. ✅ Update all references
  5. ✅ Create widget catalog
  6. ✅ Add widget variants support

Deliverables:


Phase 7: Dashboard Intelligence (6-8 hours) - P3

Tasks:

  1. ✅ Integrate @gograb-ai library
  2. ✅ Create context search
  3. ✅ Train AI on platform patterns
  4. ✅ Add intelligent suggestions
  5. ✅ Add user journey insights

Deliverables:


🗂️ File Structure Changes Needed

New Services to Create

libs/core-angular/src/lib/services/
  ├─ guest-auth.service.ts           # Guest mode authentication
  ├─ user-journey-tracker.service.ts # Journey tracking
  └─ permissions.service.ts           # User permissions

libs/core-angular/src/lib/guards/
  ├─ universe.guard.ts                # Check universe existence
  ├─ context-aware.guard.ts           # Smart redirects
  └─ permission.guard.ts              # Permission checks

libs/core-angular/src/lib/models/
  ├─ user-journey-state.interface.ts
  ├─ user-permissions.interface.ts
  └─ guest-user.interface.ts

Manifests to Create

libs/core-angular/src/lib/manifests/
  └─ user-journey-tracker.manifest.ts

libs/user-management/src/lib/
  └─ user-permissions.manifest.ts

Routes to Fix/Create

apps/gograb-space/src/app/
  ├─ app.routes.ts                    # Fix initial landing
  ├─ landing/landing.routes.ts        # Guest mode routes
  └─ guest/guest.routes.ts            # Demo mode routes (NEW)

🔑 Key Decisions to Make

Decision 1: Temp ID Format

Options:

Recommendation: Option A (temp-*) - Clear, concise, matches tempSpaceSlug


Decision 2: Data Transfer Strategy

Options:

Recommendation: Option A for MVP, Option C for v2


Decision 3: Guest Mode Duration

Options:

Recommendation: Option B (24 hours) - Creates urgency without being pushy


Decision 4: Navigation Consolidation

Which components to keep:

Recommendation: Keep MainShellComponent as single source of truth


📊 Success Metrics

Phase 1 Success:

Phase 2 Success:

Phase 3 Success:

Phase 4 Success:

Phase 5 Success:

Phase 6 Success:

Phase 7 Success:


🚀 Immediate Next Steps (Today)

Step 1: Fix Navigation Error (30 minutes)

Find and fix the undefined segment error in main-sidenav

Step 2: Integrate ModularityRoutes (15 minutes)

Add ModularityRoutes to ModularityManifest.routes

Step 3: Fix Initial Landing (30 minutes)

Update app.routes.ts to properly redirect unregistered users

Step 4: Create Guest Mode Service (2 hours)

Implement GuestAuthService with temp ID generation


📝 Notes & Considerations

Analytics Tracking

Track these metrics:

Data Transfer

Items to transfer from temp to real account:

Multi-Space Collaboration

Consider:


✅ Completion Checklist

Foundation (P0)

Enhancement (P1)

Advanced (P2)

Intelligence (P3)


Status: 🔴 IN PROGRESS
Priority: P0 - CRITICAL
Estimated Time: 30-40 hours total
Target Completion: 1-2 weeks

Let's build this platform the RIGHT way! 🚀


Created: October 29, 2025
Author: AI Assistant + User Collaboration
Version: 1.0