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:
- Multiple top-navs and side-navs scattered throughout the app
- Only one actually toggles login/logout modal properly
- Functionality is duplicated and inconsistent
Impact: Confusing UX, maintenance nightmare
Solution: Consolidate to exactly 2 navigation structures:
- Global Navigation - Platform-wide features (docs, internal tools, settings)
- 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:
- User navigates to
http://localhost:5200/ - Gets redirected to
http://localhost:5200/dashboard - Requires authentication immediately
Expected Behavior:
- Unregistered users →
/landing(marketing/demo page) - Guest mode users →
/temp-{userId}/dashboard(demo with temp data) - Registered users →
/{spaceSlug}/dashboard(full access)
Issue #4: No Guest/Demo Mode
Problem: Users must register before testing the platform
Requirement: Allow users to explore WITHOUT registration:
- Auto-generate
tempUserIdandtempSpaceSlug - Let them create/test features
- Transfer data to real account upon registration
- Track conversion analytics (temp → real users)
Issue #5: ModularityRoutes Not Being Used
Problem:
libs/modularity-lib/src/lib/modularity.routes.tsexists- Contains routes for dashboard, AI builder, module builder
- NOT integrated into app routing
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:
- User navigates to
/:spaceSlug/editorbut has NO universes - Should redirect to universe creator
- Currently shows empty/broken editor
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:
- Has user created a universe?
- Does universe have galaxies?
- Has user added sidebar/top-nav?
- Where did user navigate from?
Solution: Create UserJourneyTrackerService with manifest pattern
Issue #8: Widget System is Dispersed
Problem: Widgets scattered across multiple libraries:
@editor-ui@editor-web-lib@widgets- Unclear which to use
Solution: Consolidate widget architecture
Issue #9: No User Permissions System
Problem: No role-based access control
Requirements:
- Different user types (guest, user, admin, space-builder)
- Space collaboration (multiple users per space)
- Permission checks (can user edit? deploy? manage?)
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:
- ✅ Fix navigation error (undefined segment)
- ✅ Consolidate navigation structures
- ✅ Integrate ModularityRoutes
- ✅ Fix initial landing flow
Deliverables:
- No runtime errors
- Clean navigation (2 structures only)
- Proper initial routing
Phase 2: Guest Mode Implementation (4-6 hours) - P0
Tasks:
- ✅ Create GuestAuthService
- ✅ Generate temp IDs (tempUserId, tempSpaceSlug)
- ✅ Modify authGuard to allow guests
- ✅ Add data transfer mechanism (temp → real)
- ✅ Add demo mode banner
- ✅ Update analytics tracking
Deliverables:
- Functional guest mode
- Data transfer on registration
- Analytics for temp → real conversion
Phase 3: Context-Aware Navigation (3-4 hours) - P1
Tasks:
- ✅ Create UniverseGuard (checks if universe exists)
- ✅ Create ContextAwareGuard (smart redirects)
- ✅ Implement returnUrl mechanism
- ✅ Update all route guards
Deliverables:
- Smart redirects based on state
- No broken empty pages
- Proper context enforcement
Phase 4: User Journey Tracker (4-5 hours) - P1
Tasks:
- ✅ Create UserJourneyTrackerService
- ✅ Implement state persistence (using @storage-system)
- ✅ Add completion tracking
- ✅ Add returnUrl management
- ✅ Add analytics methods
- ✅ Create JourneyTrackerManifest (follow module pattern)
Deliverables:
- Complete journey tracking
- Analytics dashboard
- Manifest integration
Phase 5: User Permissions System (6-8 hours) - P2
Tasks:
- ✅ Study @user-management module
- ✅ Design permission model
- ✅ Implement PermissionsService
- ✅ Add role-based guards
- ✅ Add space collaboration
- ✅ Update UI (show/hide based on permissions)
Deliverables:
- Complete permissions system
- Multi-user space support
- Role-based access control
Phase 6: Widget System Consolidation (8-10 hours) - P2
Tasks:
- ✅ Audit all widget locations
- ✅ Design unified widget architecture
- ✅ Migrate widgets to @widgets library
- ✅ Update all references
- ✅ Create widget catalog
- ✅ Add widget variants support
Deliverables:
- Single source of truth for widgets
- Clear widget architecture
- Easy widget discovery
Phase 7: Dashboard Intelligence (6-8 hours) - P3
Tasks:
- ✅ Integrate @gograb-ai library
- ✅ Create context search
- ✅ Train AI on platform patterns
- ✅ Add intelligent suggestions
- ✅ Add user journey insights
Deliverables:
- Intelligent dashboard
- AI-powered suggestions
- Context-aware help
🗂️ 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:
- A:
temp-{uuid}(e.g., temp-a1b2c3d4) - B:
demo-{uuid}(e.g., demo-a1b2c3d4) - C:
guest-{uuid}(e.g., guest-a1b2c3d4)
Recommendation: Option A (temp-*) - Clear, concise, matches tempSpaceSlug
Decision 2: Data Transfer Strategy
Options:
- A: Copy all data on registration (instant)
- B: Async transfer with progress bar
- C: Selective transfer (user chooses what to keep)
Recommendation: Option A for MVP, Option C for v2
Decision 3: Guest Mode Duration
Options:
- A: No expiration (until browser clear)
- B: 24-hour session
- C: 7-day trial
Recommendation: Option B (24 hours) - Creates urgency without being pushy
Decision 4: Navigation Consolidation
Which components to keep:
- ✅ MainShellComponent (AppShell with global + space nav)
- ✅ Global top nav (single, unified)
- ❌ Remove redundant side navs
- ❌ Remove redundant top navs
Recommendation: Keep MainShellComponent as single source of truth
📊 Success Metrics
Phase 1 Success:
- Zero runtime errors
- Navigation works everywhere
- Initial landing correct
Phase 2 Success:
- Users can test without registration
- Data transfers on signup
- 30%+ conversion rate (temp → real)
Phase 3 Success:
- No broken/empty pages
- Smart redirects work
- Users never stuck
Phase 4 Success:
- Journey tracked accurately
- Analytics dashboard functional
- ReturnUrl mechanism works
Phase 5 Success:
- Permissions enforced
- Multi-user spaces work
- No unauthorized access
Phase 6 Success:
- All widgets in @widgets
- No duplicates
- Easy to find/use
Phase 7 Success:
- AI provides useful insights
- Context-aware suggestions
- Dashboard feels intelligent
🚀 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:
- Temp user creation rate
- Temp → real conversion rate
- Average demo time before signup
- Most used features in demo mode
- Drop-off points (where users leave)
Data Transfer
Items to transfer from temp to real account:
- Universes (with all galaxies/worlds)
- Pages (with all components)
- Widgets (custom widgets)
- Flows (Singularity flows)
- Modules (Modularity modules)
- Settings (user preferences)
Multi-Space Collaboration
Consider:
- Space owners vs contributors
- Permission levels (read, edit, admin)
- Invitation system
- Real-time collaboration features
✅ Completion Checklist
Foundation (P0)
- Navigation error fixed
- ModularityRoutes integrated
- Initial landing flow correct
- Guest mode implemented
- Data transfer working
Enhancement (P1)
- Context-aware navigation
- User journey tracker
- Smart redirects
Advanced (P2)
- User permissions system
- Widget consolidation
- Multi-space collaboration
Intelligence (P3)
- Dashboard AI integration
- Context search
- Intelligent suggestions
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