# cs341-illinois/broadway-on-demand architecture

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

- Interactive diagram: https://gitdiagram.com/cs341-illinois/broadway-on-demand
- Repository: https://github.com/cs341-illinois/broadway-on-demand

## Overview

Broadway on Demand is a grading-focused web application for CS 341, with a browser UI and a Fastify API. In the primary workflow, course staff manage assignments and project grading through the UI; API routes invoke domain functions that coordinate course data, grading runs, and GitHub updates. Students also use the application for course and assignment information. Scheduled jobs and Jenkins callbacks support grading operations. The graph includes documented and indexed capabilities, but several route and UI implementations were not sampled; their internal connections are shown only where supported by the excerpts, index, or README.

Main entry points: [`src/server.ts`](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/server.ts) (Application server), [`src/functions/github.ts`](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/github.ts) (GitHub operations), [`src/routes/course.ts`](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/course.ts) (Course routes), [`src/functions/assignment.ts`](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/assignment.ts) (Assignment logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_browser["Browser UI<br/>[mount.tsx]"]
  node_coursepages["Course workflows"]
  node_gradepages["Grade workflows"]
  node_authui["UI authentication<br/>[AuthContext.tsx]"]
end

subgraph group_api["API and access"]
  node_server["Application server<br/>[server.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_errorhandler["Error handling<br/>[errorHandler.ts]"]
  node_courseroutes["Course routes<br/>[course.ts]"]
  node_projectgraderoutes["Project grade routes<br/>[projectGrades.ts]"]
  node_projectreporoutes["Project repo routes<br/>[projectRepos.ts]"]
  node_otherapi["Other API routes"]
end

subgraph group_grading["Grading domain"]
  node_assignments["Assignment logic<br/>[assignment.ts]"]
  node_partners["Partner groups<br/>[partners.ts]"]
  node_projectrepos["Project repo allocation<br/>[projectRepos.ts]"]
  node_gradinglogic["Grading execution<br/>[gradeAssignment.ts]"]
end

subgraph group_operations["Integrations and jobs"]
  node_github["GitHub operations<br/>[github.ts]"]
  node_jenkins["Jenkins jobs<br/>[jenkins.ts]"]
  node_callbacks["Grader callbacks<br/>[graderCallbacks.ts]"]
  node_scheduler["Job scheduler<br/>[scheduler.ts]"]
  node_jobhandlers["Scheduled handlers<br/>[handlers.ts]"]
  node_jobrepo["Job repository"]
  node_reconciler["Job reconciliation<br/>[index.ts]"]
end

node_staff(("Course staff"))
node_students(("Students"))
node_database[("Application database")]
node_githubservice["GitHub"]
node_jenkinsservice["Jenkins"]

node_staff -.->|"uses"| node_browser
node_students -.->|"uses"| node_browser
node_browser -.->|"requests"| node_server
node_server -->|"registers"| node_courseroutes
node_server -->|"registers"| node_projectgraderoutes
node_server -->|"registers"| node_projectreporoutes
node_server -->|"registers"| node_otherapi
node_server -->|"registers"| node_auth
node_server -->|"registers"| node_errorhandler
node_authui -.->|"authenticates"| node_server
node_courseroutes -->|"calls"| node_assignments
node_courseroutes -->|"calls"| node_github
node_courseroutes -->|"calls"| node_jenkins
node_projectgraderoutes -->|"calls"| node_assignments
node_projectgraderoutes -->|"calls"| node_partners
node_projectreporoutes -->|"calls"| node_projectrepos
node_projectreporoutes -->|"calls"| node_github
node_projectrepos -->|"looks up groups"| node_partners
node_projectrepos -->|"provisions repos"| node_github
node_github -->|"uses API"| node_githubservice
node_assignments -->|"creates jobs"| node_jobrepo
node_server -->|"starts jobs"| node_jobhandlers
node_jobhandlers -->|"invokes"| node_gradinglogic
node_server -->|"starts scheduler"| node_scheduler
node_scheduler -.->|"uses repository"| node_jobrepo
node_server -->|"starts reconciliation"| node_reconciler
node_reconciler -->|"polls jobs"| node_jenkinsservice
node_jenkins -->|"runs jobs"| node_jenkinsservice
node_server -->|"registers"| node_callbacks
node_callbacks -->|"calls"| node_github
node_jobrepo -->|"reads and writes"| node_database
node_assignments -.->|"reads and writes"| node_database

click node_browser "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/client/mount.tsx"
click node_coursepages "https://github.com/cs341-illinois/broadway-on-demand/tree/main/src/client/pages"
click node_gradepages "https://github.com/cs341-illinois/broadway-on-demand/tree/main/src/client/pages"
click node_authui "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/client/contexts/AuthContext.tsx"
click node_server "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/server.ts"
click node_auth "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/plugins/auth.ts"
click node_errorhandler "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/plugins/errorHandler.ts"
click node_courseroutes "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/course.ts"
click node_projectgraderoutes "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/projectGrades.ts"
click node_projectreporoutes "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/projectRepos.ts"
click node_otherapi "https://github.com/cs341-illinois/broadway-on-demand/tree/main/src/routes"
click node_assignments "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/assignment.ts"
click node_partners "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/partners.ts"
click node_projectrepos "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/projectRepos.ts"
click node_gradinglogic "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/gradeAssignment.ts"
click node_github "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/github.ts"
click node_jenkins "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/jenkins.ts"
click node_callbacks "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/graderCallbacks.ts"
click node_scheduler "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/scheduler/scheduler.ts"
click node_jobhandlers "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/scheduler/handlers.ts"
click node_jobrepo "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/scheduler/prismaRepository.ts"
click node_reconciler "https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/reconciler/index.ts"

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,node_coursepages,node_gradepages,node_authui toneBlue
class node_server,node_auth,node_errorhandler,node_courseroutes,node_projectgraderoutes,node_projectreporoutes,node_otherapi,node_database toneAmber
class node_assignments,node_partners,node_projectrepos,node_gradinglogic toneMint
class node_github,node_jenkins,node_callbacks,node_scheduler,node_jobhandlers,node_jobrepo,node_reconciler toneRose
class node_staff,node_students,node_githubservice,node_jenkinsservice toneIndigo
```

## Components

### Web interface

- [Browser UI](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/client/mount.tsx): `src/client/mount.tsx`
- [Course workflows](https://github.com/cs341-illinois/broadway-on-demand/tree/main/src/client/pages): `src/client/pages`
- [Grade workflows](https://github.com/cs341-illinois/broadway-on-demand/tree/main/src/client/pages): `src/client/pages`
- [UI authentication](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/client/contexts/AuthContext.tsx): `src/client/contexts/AuthContext.tsx`

### API and access

- [Application server](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/server.ts): `src/server.ts`
- [Authentication](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/plugins/auth.ts): `src/plugins/auth.ts`
- [Error handling](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/plugins/errorHandler.ts): `src/plugins/errorHandler.ts`
- [Course routes](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/course.ts): `src/routes/course.ts`
- [Project grade routes](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/projectGrades.ts): `src/routes/projectGrades.ts`
- [Project repo routes](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/projectRepos.ts): `src/routes/projectRepos.ts`
- [Other API routes](https://github.com/cs341-illinois/broadway-on-demand/tree/main/src/routes): `src/routes`

### Grading domain

- [Assignment logic](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/assignment.ts): `src/functions/assignment.ts`
- [Partner groups](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/partners.ts): `src/functions/partners.ts`
- [Project repo allocation](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/projectRepos.ts): `src/functions/projectRepos.ts`
- [Grading execution](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/gradeAssignment.ts): `src/functions/gradeAssignment.ts`

### Integrations and jobs

- [GitHub operations](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/github.ts): `src/functions/github.ts`
- [Jenkins jobs](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/functions/jenkins.ts): `src/functions/jenkins.ts`
- [Grader callbacks](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/routes/graderCallbacks.ts): `src/routes/graderCallbacks.ts`
- [Job scheduler](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/scheduler/scheduler.ts): `src/scheduler/scheduler.ts`
- [Scheduled handlers](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/scheduler/handlers.ts): `src/scheduler/handlers.ts`
- [Job repository](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/scheduler/prismaRepository.ts): `src/scheduler/prismaRepository.ts`
- [Job reconciliation](https://github.com/cs341-illinois/broadway-on-demand/blob/main/src/reconciler/index.ts): `src/reconciler/index.ts`

### Other components

- **Course staff**
- **Students**
- **Application database**
- **GitHub**
- **Jenkins**

## Connections

- Course staff → Browser UI: uses
- Students → Browser UI: uses
- Browser UI → Application server: requests
- Application server → Course routes: registers (evidence: `src/server.ts`)
- Application server → Project grade routes: registers (evidence: `src/server.ts`)
- Application server → Project repo routes: registers (evidence: `src/server.ts`)
- Application server → Other API routes: registers (evidence: `src/server.ts`)
- Application server → Authentication: registers (evidence: `src/server.ts`)
- Application server → Error handling: registers (evidence: `src/server.ts`)
- UI authentication → Application server: authenticates
- Course routes → Assignment logic: calls (evidence: `src/routes/course.ts`)
- Course routes → GitHub operations: calls (evidence: `src/routes/course.ts`)
- Course routes → Jenkins jobs: calls (evidence: `src/routes/course.ts`)
- Project grade routes → Assignment logic: calls (evidence: `src/routes/projectGrades.ts`)
- Project grade routes → Partner groups: calls (evidence: `src/routes/projectGrades.ts`)
- Project repo routes → Project repo allocation: calls (evidence: `src/routes/projectRepos.ts`)
- Project repo routes → GitHub operations: calls (evidence: `src/routes/projectRepos.ts`)
- Project repo allocation → Partner groups: looks up groups (evidence: `src/functions/projectRepos.ts`)
- Project repo allocation → GitHub operations: provisions repos (evidence: `src/functions/projectRepos.ts`)
- GitHub operations → GitHub: uses API (evidence: `src/functions/github.ts`)
- Assignment logic → Job repository: creates jobs (evidence: `src/functions/assignment.ts`)
- Application server → Scheduled handlers: starts jobs (evidence: `src/server.ts`)
- Scheduled handlers → Grading execution: invokes (evidence: `src/scheduler/handlers.ts`)
- Application server → Job scheduler: starts scheduler (evidence: `src/server.ts`)
- Job scheduler → Job repository: uses repository
- Application server → Job reconciliation: starts reconciliation (evidence: `src/server.ts`)
- Job reconciliation → Jenkins: polls jobs (evidence: `src/reconciler/index.ts`)
- Jenkins jobs → Jenkins: runs jobs
- Application server → Grader callbacks: registers (evidence: `src/server.ts`)
- Grader callbacks → GitHub operations: calls (evidence: `src/routes/graderCallbacks.ts`)
- Job repository → Application database: reads and writes (evidence: `src/scheduler/prismaRepository.ts`)
- Assignment logic → Application database: reads and writes
