# alice-2702/classforge-ai-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/alice-2702/classforge-ai-simulator
- Repository: https://github.com/alice-2702/classforge-ai-simulator

## Overview

Classforge is a browser-based AI teaching simulator: a teacher logs in, chooses a learner profile and lesson topic, starts a simulated lesson, then requests teaching moves and receives advice plus a simulated student reply. The implementation is a small static frontend backed by Express endpoints; the “AI” behavior shown in the source is profile-based templates and randomized replies, not an external AI service. The tree and excerpts show no persistence or authentication-token enforcement. HTML view details are not sampled, so the frontend is represented through its controller and entry page.

Main entry points: [`app.js`](https://github.com/alice-2702/classforge-ai-simulator/blob/main/app.js) (Simulator controller), [`server.js`](https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js) (Lesson start endpoint), [`index.html`](https://github.com/alice-2702/classforge-ai-simulator/blob/main/index.html) (Login and lesson views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_teacher_ui["Teacher interface"]
  node_browser_ui["Simulator controller<br/>[app.js]"]
  node_login_view["Login and lesson views<br/>[index.html]"]
end

subgraph group_lesson_sim["Lesson simulation"]
  node_profile_logic["Learner profiles<br/>[server.js]"]
  node_topic_logic["Lesson topics<br/>[server.js]"]
  node_reply_logic["Student reply generator<br/>[server.js]"]
end

subgraph group_http_app["Web application"]
  node_login_api["Login endpoint<br/>[server.js]"]
  node_lesson_start["Lesson start endpoint<br/>[server.js]"]
  node_lesson_action["Teaching action endpoint<br/>[server.js]"]
end

node_teacher(("Teacher"))

node_teacher -->|"uses"| node_login_view
node_login_view -.->|"controls"| node_browser_ui
node_browser_ui -->|"posts credentials"| node_login_api
node_browser_ui -->|"starts lesson"| node_lesson_start
node_browser_ui -->|"requests move"| node_lesson_action
node_lesson_start -->|"selects profile"| node_profile_logic
node_lesson_start -->|"selects topic"| node_topic_logic
node_lesson_start -->|"generates reply"| node_reply_logic
node_lesson_action -->|"selects profile"| node_profile_logic
node_lesson_action -->|"generates reply"| node_reply_logic
node_login_api -->|"returns token and name"| node_browser_ui
node_lesson_start -->|"returns messages"| node_browser_ui
node_lesson_action -->|"returns advice and reply"| node_browser_ui

click node_browser_ui "https://github.com/alice-2702/classforge-ai-simulator/blob/main/app.js"
click node_login_view "https://github.com/alice-2702/classforge-ai-simulator/blob/main/index.html"
click node_login_api "https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js"
click node_lesson_start "https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js"
click node_lesson_action "https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js"
click node_profile_logic "https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js"
click node_topic_logic "https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js"
click node_reply_logic "https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser_ui,node_login_view toneBlue
class node_profile_logic,node_topic_logic,node_reply_logic toneAmber
class node_login_api,node_lesson_start,node_lesson_action toneMint
class node_teacher toneIndigo
```

## Components

### Teacher interface

- [Simulator controller](https://github.com/alice-2702/classforge-ai-simulator/blob/main/app.js): `app.js`
- [Login and lesson views](https://github.com/alice-2702/classforge-ai-simulator/blob/main/index.html): `index.html`

### Lesson simulation

- [Learner profiles](https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js): `server.js`
- [Lesson topics](https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js): `server.js`
- [Student reply generator](https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js): `server.js`

### Web application

- [Login endpoint](https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js): `server.js`
- [Lesson start endpoint](https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js): `server.js`
- [Teaching action endpoint](https://github.com/alice-2702/classforge-ai-simulator/blob/main/server.js): `server.js`

### Other components

- **Teacher**

## Connections

- Teacher → Login and lesson views: uses (evidence: `README.md`)
- Login and lesson views → Simulator controller: controls
- Simulator controller → Login endpoint: posts credentials (evidence: `app.js`)
- Simulator controller → Lesson start endpoint: starts lesson (evidence: `app.js`)
- Simulator controller → Teaching action endpoint: requests move (evidence: `app.js`)
- Lesson start endpoint → Learner profiles: selects profile (evidence: `server.js`)
- Lesson start endpoint → Lesson topics: selects topic (evidence: `server.js`)
- Lesson start endpoint → Student reply generator: generates reply (evidence: `server.js`)
- Teaching action endpoint → Learner profiles: selects profile (evidence: `server.js`)
- Teaching action endpoint → Student reply generator: generates reply (evidence: `server.js`)
- Login endpoint → Simulator controller: returns token and name (evidence: `app.js`)
- Lesson start endpoint → Simulator controller: returns messages (evidence: `app.js`)
- Teaching action endpoint → Simulator controller: returns advice and reply (evidence: `app.js`)
