# mahammadwahab540/prism-education architecture

> Architecture diagram of the GitHub repository mahammadwahab540/prism-education, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahammadwahab540/prism-education
- Repository: https://github.com/mahammadwahab540/prism-education

## Overview

##### Project Type and Purpose
- This is a single-page front-end application (SPA) built with Vite, TypeScript, React, Tailwind CSS and shadcn-ui.
- Its primary purpose is to provide a rich UI for managing “capstone” projects, user profiles, analytics dashboards, tenant administration, and integrations with an LLM-based “Capstone Orchestrator.”

##### File Structure Analysis
- Top-level:
- index.html, main.tsx – entry point for the Vite React app
- src/
– pages/ – route components mapped by your React router
– components/ – presentational and container components organized by feature (admin, analytics, capstone, dashboard, ui, etc.)
– contexts/, hooks/ – React Contexts for global state (Auth, LearningPath, Notifications, ProfilePanel) and custom hooks for encapsulated logic
– lib/ – domain logic + mock/facade for the Capstone Orchestrator + utilities + telemetry + mock data
– services/ – API layer wrapping HTTP calls (e.g. tenants.ts, export.ts)
– types/ – shared TypeScript types and Zod schemas validating orchestrator payloads
- Config & tooling:
- Vite (vite.config.ts), TS configs (tsconfig.*), ESLint, Tailwind, PostCSS

##### Key Insights from README
- “Capstone Orchestrator” module uses Zod schemas, system & developer prompts, and offers both mock and real LLM invocation.
- No backend code in this repo; it expects external REST endpoints (e.g. tenant management, exports).
- Full UI driven by React + shadcn-ui + Tailwind

##### Major Components
A. Client (Browser)
1. React SPA – entry point at main.tsx → App.tsx → Router → pages/*
2. UI Layer – shadcn-ui + Tailwind components in src/components/ui and feature-specific components
3. State Management – React Contexts (AuthContext, NotificationContext, etc.) + Hooks
B. Business-Logic Layer (in-browser)
1. Capstone Orchestrator Facade (src/lib/capstoneOrchestrator.ts)
2. Validation & Transformation (Zod schemas + orchestrationToRoadmap)
C. API Layer
1. services/*.ts – HTTP wrappers calling external REST endpoints (tenant management, exports)
2. Telemetry & Analytics (src/lib/telemetry.ts)
D. External Services
1. REST API server (authentication, tenant data, analytics back-end)
2. LLM endpoint (OpenAI or similar) for production orchestration
3. Optional Mock Data for local dev

##### Relationships & Interactions
- User interacts with React UI → triggers Actions
- UI dispatches through Contexts/Hooks → calls service functions or lib/orchestrator functions
- services/*.ts functions → HTTP → REST API → returns JSON → UI updates
- Orchestrator in mock mode bypasses REST/LLM for dev; in prod it sends prompts to LLM endpoint
- Telemetry calls fire on key user events to telemetry endpoint

##### Architectural Patterns & Design Principles
- Feature-driven component organization (each domain area under src/components)
- Separation of concerns: UI components vs. contexts vs. services vs. domain logic in lib vs. types/schemas
- Mock-first development for LLM orchestration
- Type safety end-to-end with TypeScript and Zod
- Single SPAs with client-side routing

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Browser - Presentation Layer"
        HTML["index.html"]:::ui
        Main["src/main.tsx"]:::ui
        App["src/App.tsx"]:::ui
        Router["Routing Pages\nsrc/pages/*"]:::ui
        UIlib["UI Component Library\nsrc/components/ui/*"]:::ui
        FeatureUI["Feature-Specific UI Components\nsrc/components/<feature>/*"]:::ui
    end

    subgraph "Browser - Client Logic Layer"
        subgraph "Contexts"
            AuthCtx["AuthContext"]:::logic
            LearningCtx["LearningPathContext"]:::logic
            NotifCtx["NotificationContext"]:::logic
            ProfileCtx["ProfilePanelContext"]:::logic
        end
        Hooks["Custom Hooks\nsrc/hooks/*"]:::logic
        Orchestrator["Capstone Orchestrator\nsrc/lib/capstoneOrchestrator.ts"]:::logic
        MockOrch["Mock Orchestrator\nsrc/lib/capstoneMock.ts"]:::logic
        MockData["Mock Data\nsrc/lib/mockData.ts"]:::logic
        Prompts["LLM Prompts\nsrc/lib/prompts/capstoneOrchestrator.ts"]:::logic
        Validation["Zod Schemas & Types\nsrc/types/*"]:::logic
        subgraph "Domain Logic & Utilities"
            Account["account.ts"]:::logic
            History["learningHistory.ts"]:::logic
            Skills["skillsStore.ts"]:::logic
            Utils["utils.ts"]:::logic
        end
    end

    subgraph "Browser - Data & Services Layer"
        TenantsSvc["Tenant Service\nsrc/services/tenants.ts"]:::service
        ExportSvc["Export Service\nsrc/services/export.ts"]:::service
        Telemetry["Telemetry\nsrc/lib/telemetry.ts"]:::service
        Analytics["Analytics\nsrc/lib/analytics.ts"]:::service
    end

    subgraph "External Services"
        REST["REST API Server"]:::external
        LLM["LLM Endpoint"]:::external
    end

    %% Flows
    HTML --> Main --> App --> Router
    App --> UIlib
    App --> FeatureUI
    FeatureUI --> AuthCtx
    FeatureUI --> LearningCtx
    FeatureUI --> NotifCtx
    FeatureUI --> ProfileCtx
    AuthCtx --> Hooks
    LearningCtx --> Hooks
    NotifCtx --> Hooks
    ProfileCtx --> Hooks
    Hooks --> TenantsSvc
    Hooks --> ExportSvc
    Hooks --> Orchestrator
    Orchestrator --> Prompts
    Orchestrator --> Validation
    Orchestrator --> MockOrch
    Orchestrator --> MockData
    TenantsSvc --> REST
    ExportSvc --> REST
    Telemetry --> REST
    Analytics --> REST
    Orchestrator --> LLM

    %% Click Events
    click HTML "https://github.com/mahammadwahab540/prism-education/blob/prod/index.html"
    click Main "https://github.com/mahammadwahab540/prism-education/blob/prod/src/main.tsx"
    click App "https://github.com/mahammadwahab540/prism-education/blob/prod/src/App.tsx"
    click Router "https://github.com/mahammadwahab540/prism-education/tree/prod/src/pages/*"
    click UIlib "https://github.com/mahammadwahab540/prism-education/tree/prod/src/components/ui/*"
    click FeatureUI "https://github.com/mahammadwahab540/prism-education/tree/prod/src/components/<feature>/*"
    click AuthCtx "https://github.com/mahammadwahab540/prism-education/blob/prod/src/contexts/AuthContext.tsx"
    click LearningCtx "https://github.com/mahammadwahab540/prism-education/blob/prod/src/contexts/LearningPathContext.tsx"
    click NotifCtx "https://github.com/mahammadwahab540/prism-education/blob/prod/src/contexts/NotificationContext.tsx"
    click ProfileCtx "https://github.com/mahammadwahab540/prism-education/blob/prod/src/contexts/ProfilePanelContext.tsx"
    click Hooks "https://github.com/mahammadwahab540/prism-education/tree/prod/src/hooks/*"
    click Orchestrator "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/capstoneOrchestrator.ts"
    click MockOrch "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/capstoneMock.ts"
    click MockData "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/mockData.ts"
    click Prompts "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/prompts/capstoneOrchestrator.ts"
    click Validation "https://github.com/mahammadwahab540/prism-education/tree/prod/src/types/*"
    click Account "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/account.ts"
    click History "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/learningHistory.ts"
    click Skills "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/skillsStore.ts"
    click Utils "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/utils.ts"
    click TenantsSvc "https://github.com/mahammadwahab540/prism-education/blob/prod/src/services/tenants.ts"
    click ExportSvc "https://github.com/mahammadwahab540/prism-education/blob/prod/src/services/export.ts"
    click Telemetry "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/telemetry.ts"
    click Analytics "https://github.com/mahammadwahab540/prism-education/blob/prod/src/lib/analytics.ts"

    %% Styles
    classDef ui fill:#8fd3f4,stroke:#333,stroke-width:1px
    classDef logic fill:#c2f0c2,stroke:#333,stroke-width:1px
    classDef service fill:#fbe08a,stroke:#333,stroke-width:1px
    classDef external fill:#f4c2c2,stroke:#333,stroke-width:1px
```
