{
  "$schema": "dss-knowledge-v1",
  "type": "architecture",
  "version": "0.8.0",
  "last_updated": null,
  "modules": [
    {
      "name": "messaging",
      "path": "admin-ui/js/core/messaging.js",
      "purpose": "Centralized notification system with structured error taxonomy and correlation IDs",
      "features": [
        "Event bus using CustomEvent API",
        "Structured message format with correlation IDs",
        "Error taxonomy (E1xxx-E5xxx for errors, S1xxx for success)",
        "Message persistence via localStorage",
        "Helper functions: notifySuccess, notifyError, notifyWarning, notifyInfo",
        "Message history and debugging capabilities"
      ],
      "error_codes": {
        "E1xxx": "User errors (invalid input, forbidden actions)",
        "E2xxx": "Validation errors (missing fields, invalid formats)",
        "E3xxx": "API errors (request failed, timeout, unauthorized)",
        "E4xxx": "System errors (unexpected, network, storage)",
        "E5xxx": "Integration errors (Figma connection, API errors)",
        "S1xxx": "Success codes (operation complete, created, updated, deleted)"
      }
    },
    {
      "name": "router",
      "path": "admin-ui/js/core/router.js",
      "purpose": "Centralized hash-based routing with guards and lifecycle hooks",
      "features": [
        "Centralized route registry",
        "Route guards (beforeEnter, afterEnter, onLeave)",
        "History management",
        "Programmatic navigation",
        "Route metadata support",
        "Common guards (requireAuth, requireProject)"
      ],
      "routes": [
        "dashboard",
        "projects",
        "tokens",
        "components",
        "figma",
        "docs",
        "teams",
        "audit",
        "settings",
        "services",
        "quick-wins",
        "chat"
      ]
    },
    {
      "name": "workflows",
      "path": "admin-ui/js/core/workflows.js",
      "purpose": "Orchestrate multi-step user workflows with state machines",
      "features": [
        "Base StateMachine class",
        "CreateProjectWorkflow (Create \u2192 Configure \u2192 Extract \u2192 Success)",
        "TokenExtractionWorkflow (Connect \u2192 Select \u2192 Extract \u2192 Sync)",
        "Progress tracking",
        "State transition guards",
        "Side effects via actions",
        "Event emission for UI updates"
      ]
    },
    {
      "name": "rest_api",
      "path": "/home/overbits/dss/tools/api/server.py",
      "purpose": "FastAPI server providing REST API and static file serving",
      "port": 3456,
      "endpoints": [],
      "mounts": [
        {
          "path": "/admin-ui",
          "type": "StaticFiles",
          "line_number": 258
        },
        {
          "path": "/",
          "type": "StaticFiles",
          "line_number": 3073
        }
      ],
      "total_endpoints": 0
    }
  ],
  "design_patterns": [
    "Separation of Concerns",
    "Single Responsibility Principle",
    "Dependency Injection",
    "Observer Pattern",
    "State Machine Pattern",
    "Command Pattern",
    "Strategy Pattern"
  ],
  "performance": {
    "bundle_size_increase": "+15KB (minified)",
    "initialization_time_increase": "+50ms",
    "memory_usage": "+~1MB (50 messages in localStorage)",
    "network_impact": "No additional requests"
  },
  "_metadata": {
    "generator": "APIExtractor",
    "generated_at": "2025-12-07T18:27:49.697019",
    "source_files": [
      "/home/overbits/dss/tools/api/server.py"
    ],
    "version": "1.0.0"
  }
}