# zmuhls/cuny-ai architecture

> Architecture diagram of the GitHub repository zmuhls/cuny-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zmuhls/cuny-ai
- Repository: https://github.com/zmuhls/cuny-ai

## Overview

##### Project Type and Purpose
- This is a single-page interactive front-end guide (built with React + Vite + TypeScript) that teaches AI prompting techniques. It is a static site (deployed to GitHub Pages) but integrates at run time with external LLM/VLM APIs (via OpenRouter).

##### High-Level Components
a. Developer Workflow & CI/CD
- GitHub Repo (.github/workflows/ci-cd.yml)
- Vite build (vite.config.js, tsconfig.json, postcss.config.js, tailwind.config.js)
- GitHub Actions: builds `dist/` and deploys to GitHub Pages (base URL `/cuny-ai/`).
b. Static Assets & Hosting
- `dist/` – production build artifacts (index.html, JS bundles, pages, assets)
- `public/` – public-facing static files (images, PDF resources)
- Hosted on GitHub Pages
c. Client-side Application
- React App entry (src/main.jsx ➔ src/App.jsx)
- UI Components (src/components & src/components/steps)
- Styles (src/styles/index.css, Tailwind CSS via PostCSS)
d. External Services
- OpenRouter API endpoint (`https://openrouter.ai/api/v1/chat/completions`)
- Various model providers (OpenAI, Anthropic, Google, Mistral)

##### Relationships & Data Flows
- Developer pushes code → GitHub Actions triggers → Vite builds → Artifacts (dist/) are deployed to GitHub Pages.
- End user (mobile/desktop browser) requests `/cuny-ai/` → GitHub Pages serves static HTML/CSS/JS → React app hydrates in browser.
- User clicks through interactive steps → client JS may invoke fetch calls to the OpenRouter API (with API Key) → receives LLM/VLM responses → renders examples/comparisons/glossary.

##### Architectural Patterns & Principles
- Single-Page Application (SPA) with client-side routing (implicit via Vite & static page snapshots)
- Component-based UI (step modules under src/components/steps)
- Mobile-first, responsive design (Tailwind utility classes + PostCSS)
- Path aliasing (configured in tsconfig.json) for cleaner imports

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build Pipeline
    subgraph "Developer & CI/CD"
        DW["Developer Workstation"]:::build
        GH["GitHub Repo"]:::build
        CI["CI/CD Pipeline"]:::build
        DW -->|git push| GH
        GH -->|triggers workflow| CI
    end

    subgraph "Build Configuration" 
        VITE["vite.config.js"]:::build
        TS["tsconfig.json"]:::build
        TSN["tsconfig.node.json"]:::build
        POST["postcss.config.js"]:::build
        TAIL["tailwind.config.js"]:::build
        PKG["package.json"]:::build
        PKGL["package-lock.json"]:::build
        CI -->|uses config| VITE
        CI --> TS
        CI --> TSN
        CI --> POST
        CI --> TAIL
        CI --> PKG
        CI --> PKGL
    end

    CI -->|build → publish| Dist["dist/ (Build Artifacts)"]:::hosting
    click VITE "https://github.com/zmuhls/cuny-ai/blob/master/vite.config.js"
    click TS "https://github.com/zmuhls/cuny-ai/blob/master/tsconfig.json"
    click TSN "https://github.com/zmuhls/cuny-ai/blob/master/tsconfig.node.json"
    click POST "https://github.com/zmuhls/cuny-ai/blob/master/postcss.config.js"
    click TAIL "https://github.com/zmuhls/cuny-ai/blob/master/tailwind.config.js"
    click PKG "https://github.com/zmuhls/cuny-ai/blob/master/package.json"
    click PKGL "https://github.com/zmuhls/cuny-ai/blob/master/package-lock.json"
    click Dist "https://github.com/zmuhls/cuny-ai/tree/master/dist/"

    %% Static Hosting & Assets
    subgraph "Static Hosting & Assets"
        GHP["GitHub Pages"]:::hosting
        PUBLIC["public/"]:::hosting
        RES1["resources/pdf/resource.pdf"]:::hosting
        RES2["resources/pdf/worksheet.pdf"]:::hosting
        IMAGES["images/"]:::hosting
        STYLEAS["style/styles.css"]:::hosting
        JSAS["js/madlib.js"]:::hosting
        Dist -->|deploy| GHP
    end
    click PUBLIC "https://github.com/zmuhls/cuny-ai/tree/master/public/"
    click RES1 "https://github.com/zmuhls/cuny-ai/blob/master/resources/pdf/resource.pdf"
    click RES2 "https://github.com/zmuhls/cuny-ai/blob/master/resources/pdf/worksheet.pdf"
    click IMAGES "https://github.com/zmuhls/cuny-ai/tree/master/images/"
    click STYLEAS "https://github.com/zmuhls/cuny-ai/blob/master/style/styles.css"
    click JSAS "https://github.com/zmuhls/cuny-ai/blob/master/js/madlib.js"

    %% Client Runtime
    subgraph "Client Runtime"
        Browser["Browser / Client"]:::runtime
        Browser -->|GET /cuny-ai/| GHP
        Browser --> Main
        Main["src/main.jsx"]:::runtime
        Main --> AppC
        AppC["src/App.jsx"]:::runtime
        AppC --> NavC
        AppC --> SeqNav
        AppC --> StepInd
        AppC --> KeyFooter
        subgraph "Step Components"
            Welcome["WelcomeStep"]:::runtime
            Glossary["GlossaryStep"]:::runtime
            MadLib["MadLibStep"]:::runtime
            ModelComp["ModelComparisonsStep"]:::runtime
            ORStep["OpenRouterStep"]:::runtime
            PromptEx["PromptingExercisesStep"]:::runtime
            Roadmap["RoadmapStep"]:::runtime
            AppC --> Welcome
            AppC --> Glossary
            AppC --> MadLib
            AppC --> ModelComp
            AppC --> ORStep
            AppC --> PromptEx
            AppC --> Roadmap
        end
    end
    click Main "https://github.com/zmuhls/cuny-ai/blob/master/src/main.jsx"
    click AppC "https://github.com/zmuhls/cuny-ai/blob/master/src/App.jsx"
    click NavC "https://github.com/zmuhls/cuny-ai/blob/master/src/components/NavigationControls.jsx"
    click SeqNav "https://github.com/zmuhls/cuny-ai/blob/master/src/components/SequenceNavigation.jsx"
    click StepInd "https://github.com/zmuhls/cuny-ai/blob/master/src/components/StepIndicator.jsx"
    click KeyFooter "https://github.com/zmuhls/cuny-ai/blob/master/src/components/KeyTermsFooter.jsx"
    click Welcome "https://github.com/zmuhls/cuny-ai/blob/master/src/components/steps/WelcomeStep.jsx"
    click Glossary "https://github.com/zmuhls/cuny-ai/blob/master/src/components/steps/GlossaryStep.jsx"
    click MadLib "https://github.com/zmuhls/cuny-ai/blob/master/src/components/steps/MadLibStep.jsx"
    click ModelComp "https://github.com/zmuhls/cuny-ai/blob/master/src/components/steps/ModelComparisonsStep.jsx"
    click ORStep "https://github.com/zmuhls/cuny-ai/blob/master/src/components/steps/OpenRouterStep.jsx"
    click PromptEx "https://github.com/zmuhls/cuny-ai/blob/master/src/components/steps/PromptingExercisesStep.jsx"
    click Roadmap "https://github.com/zmuhls/cuny-ai/blob/master/src/components/steps/RoadmapStep.jsx"

    %% External API
    subgraph "External Services"
        OR["OpenRouter API"]:::external
        MP["Model Providers"]:::external
        OR --> MP
    end
    AppC -->|"POST /chat/completions"| OR
    OR -->|"responses"| AppC

    %% Styles
    classDef build fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef hosting fill:#F0F0F0,stroke:#888888,color:#555555
    classDef runtime fill:#E6FFEA,stroke:#28A745,color:#28A745
    classDef external fill:#FFF4E5,stroke:#F66A0A,color:#F66A0A
```
