PROJECT SCOPED ARCHITECTURE

Comprehensive documentation system guides

Project-Scoped Root Architecture

🎯 Overview

The docs-angular application has been transformed from a folder-based routing system to a project-scoped root architecture where each project acts as its own application root, with explicit project selection and state management.

📐 Architecture Principles

1. Explicit Project Selection

2. Project as Context

3. Preserved Access Control

4. Clean Separation

🏗️ Key Components

State Management

ProjectSelectionState

{
  currentProjectId: string | null,
  currentProjectMetadata: ProjectMetadata | null,
  availableProjects: ProjectMetadata[],
  lastSelectedTimestamp: number | null,
  isInitialized: boolean
}

Actions:

Services

DocsConfigService

PathResolutionService

AccessService (Enhanced)

NavigationService

Components

ProjectSelectionComponent

ProjectSwitcherComponent

📊 URL Structure

Before (Folder-Based)

http://localhost:5010/getting-started           → public project
http://localhost:5010/GoGrab-Space/architecture → GoGrab-Space project
http://localhost:5010/private/confidential      → private project

After (Project-Scoped)

http://localhost:5010/select-project            → Project selection
http://localhost:5010/architecture              → Current project's architecture page
http://localhost:5010/libs/ux-portal            → Current project's libs/ux-portal page

Project Context: Stored in ProjectSelectionState, not in URL

🔐 Access Control Matrix

Current Project Type Can Access Public Projects Can Access Private Projects Notes
Public ✅ Yes (all public) ✅ If unlocked Standard public access
Private (hasAccessToPublic: true) ✅ Yes ✅ If unlocked Enhanced private project
Private (hasAccessToPublic: false) ❌ No ✅ Own + unlocked Restricted private project
No Selection ✅ Yes (public only) ❌ No Before project selection

🔄 Project Selection Flow

graph TD
    A[User Visits App] --> B{Project Selected?}
    B -->|No| C[Show Project Selection Page]
    B -->|Yes| D[Load Project from State]
    C --> E[User Selects Project]
    E --> F{Requires Password?}
    F -->|Yes| G[Prompt Password]
    F -->|No| H[Store in State]
    G --> I{Correct?}
    I -->|Yes| H
    I -->|No| E
    H --> J[Navigate to Project]
    J --> K[Load Documentation]

📁 Path Resolution

DocsConfigService

effectiveDocsPath() {
  const project = currentProject();
  if (!project) return 'docs';
  
  const lang = project.language === 'spanish' ? 'spanish' : 'english';
  return `docs/${lang}/${project.name}`;
}

PathResolutionService

resolveDocumentationFilePath(relativePath: string) {
  const basePath = this.getEffectiveDocsPath(); // docs/english/GoGrab-Space
  const cleanPath = relativePath.replace(/^\/+/, '');
  return `${basePath}/${cleanPath}.md`; // docs/english/GoGrab-Space/architecture.md
}

🚀 Benefits

User Experience

  1. Clear Project Context: Always know which project you're viewing
  2. Explicit Selection: No ambiguity about current project
  3. Fast Switching: Quick project selection via beautiful UI
  4. Persistent State: Remember project across sessions

Developer Experience

  1. Simplified Paths: No project name in URLs
  2. Type Safety: Strong typing with ProjectMetadata
  3. Centralized State: Single source of truth (NGXS)
  4. Easier Testing: Mock project selection state

Architecture

  1. Clean Separation: Each project is independent
  2. Access Control: Fine-grained project visibility rules
  3. Scalability: Easy to add new projects
  4. Maintainability: Less complex path resolution

⚠️ Breaking Changes

URLs

Bookmarks

Cross-Project Links

🔧 Configuration

Project Definition (docs-folders-config.json)

{
  "name": "GoGrab-Space",
  "path": "docs/english/GoGrab-Space",
  "language": "english",
  "isRoot": true,
  "password": null,
  "config": {
    "search": {
      "scopeToCurrentProject": true,
      "crossProjectSearch": false,
      "hasAccessToPublic": false
    },
    "navigation": {
      "enableBreadcrumbs": true,
      "showProjectIcon": true
    }
  }
}

Access Rules

📝 Implementation Checklist

✅ Completed

🔄 In Progress

⏳ Pending

🎓 Best Practices

For Developers

  1. Always use DocsConfigService.effectiveDocsPath() for base paths
  2. Never hardcode project names in URLs
  3. Use AccessService.canAccessProject() before cross-project features
  4. Test with multiple projects selected

For Users

  1. Select your primary project on first visit
  2. Use project switcher for changing projects
  3. Unlock private projects to maintain access
  4. Bookmark /select-project for quick project changes

📚 Related Documentation


Last Updated: Implementation in progress Version: 1.0.0-alpha Status: Active Development