{
  "$schema": "dss-knowledge-v1",
  "type": "architecture",
  "version": "0.8.0",
  "last_updated": "2025-12-07",
  "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 → Configure → Extract → Success)",
        "TokenExtractionWorkflow (Connect → Select → Extract → Sync)",
        "Progress tracking",
        "State transition guards",
        "Side effects via actions",
        "Event emission for UI updates"
      ]
    }
  ],
  "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"
  }
}
