# chinoarror/class-schedule architecture

> Architecture diagram of the GitHub repository chinoarror/class-schedule, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chinoarror/class-schedule
- Repository: https://github.com/chinoarror/class-schedule
- Video tour (about a minute): https://gitdiagram.com/chinoarror/class-schedule/video

## Overview

CampusFlow brings schedules, tasks, notes, reminders, and controlled schedule sharing together for university students. The main workflow is sign-in, view or import a schedule, manage learning work, and configure sharing or notification delivery. The web app calls the Worker API for authenticated state and service operations; scheduled Worker jobs dispatch reminders through configured channels. The extension stages a local course preview for confirmation in CampusFlow. README documents notes and attachments, but their implementation is not sampled, so links are limited to the documented subsystem path.

Main entry points: [`src/web/App.tsx`](https://github.com/chinoarror/class-schedule/blob/master/src/web/App.tsx) (CampusFlow UI), [`src/worker/index.ts`](https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts) (API and jobs), [`extension/src/ehall-notice.js`](https://github.com/chinoarror/class-schedule/blob/master/extension/src/ehall-notice.js) (Import panel), [`src/worker/auth.ts`](https://github.com/chinoarror/class-schedule/blob/master/src/worker/auth.ts) (Auth verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Student workspace"]
  node_app["CampusFlow UI<br/>[App.tsx]"]
  node_term["Term calendar<br/>[term.ts]"]
  node_schedule["Schedules"]
  node_todos["Todo list"]
  node_notes["Notes and files"]
  node_sharing["Schedule sharing"]
  node_reminderui["Reminder settings<br/>[App.tsx]"]
end

subgraph group_api["Worker services"]
  node_worker["API and jobs<br/>[index.ts]"]
  node_auth["Auth verification<br/>[auth.ts]"]
  node_state[("User state<br/>[index.ts]")]
  node_attachments[("Attachment storage")]
  node_shares[("Share records<br/>[index.ts]")]
end

subgraph group_notify["Notifications"]
  node_scheduler["Reminder dispatch<br/>[index.ts]"]
  node_email["Email channel<br/>[emails.ts]"]
  node_webhooks["Webhook channels<br/>[webhooks.ts]"]
  node_queue["Delivery queue<br/>[index.ts]"]
end

subgraph group_import["Schedule import"]
  node_extensionui["Import panel<br/>[ehall-notice.js]"]
  node_parser["BK-KQ parser<br/>[bk-kq-parser.js]"]
  node_background["Preview staging<br/>[background.js]"]
  node_session[("Extension session<br/>[background.js]")]
end

node_student(("Student"))
node_browser(("Browser"))
node_authcenter["Auth Center"]
node_providers["Delivery providers"]
node_school["XJTU schedule page"]

node_student -->|"uses"| node_app
node_app -->|"gets term dates"| node_term
node_app -->|"calls API"| node_worker
node_worker -->|"verifies token"| node_auth
node_auth -->|"checks identity"| node_authcenter
node_worker -->|"reads and writes state"| node_state
node_worker -->|"reads and writes shares"| node_shares
node_app -->|"shows schedule"| node_schedule
node_app -->|"shows tasks"| node_todos
node_app -->|"offers sharing"| node_sharing
node_app -->|"configures reminders"| node_reminderui
node_app -.->|"offers notes"| node_notes
node_app -.->|"uploads attachments"| node_attachments
node_worker -->|"runs scheduled checks"| node_scheduler
node_scheduler -->|"reads schedules and tasks"| node_state
node_scheduler -->|"enqueues deliveries"| node_queue
node_queue -->|"dispatches events"| node_webhooks
node_webhooks -->|"sends webhook events"| node_providers
node_scheduler -->|"prepares email"| node_email
node_email -->|"sends mail"| node_providers
node_student -->|"starts import"| node_extensionui
node_school -->|"provides page"| node_extensionui
node_extensionui -->|"parses BK-KQ page"| node_parser
node_extensionui -->|"stores preview"| node_background
node_background -->|"writes and reads preview"| node_session
node_browser -->|"returns to confirm"| node_app

click node_app "https://github.com/chinoarror/class-schedule/blob/master/src/web/App.tsx"
click node_term "https://github.com/chinoarror/class-schedule/blob/master/src/shared/term.ts"
click node_schedule "https://github.com/chinoarror/class-schedule/tree/master/src/web"
click node_todos "https://github.com/chinoarror/class-schedule/tree/master/src/web"
click node_notes "https://github.com/chinoarror/class-schedule/tree/master/src/web"
click node_sharing "https://github.com/chinoarror/class-schedule/tree/master/src/web"
click node_reminderui "https://github.com/chinoarror/class-schedule/blob/master/src/web/App.tsx"
click node_worker "https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts"
click node_auth "https://github.com/chinoarror/class-schedule/blob/master/src/worker/auth.ts"
click node_state "https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts"
click node_attachments "https://github.com/chinoarror/class-schedule/tree/master/src/web"
click node_shares "https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts"
click node_scheduler "https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts"
click node_email "https://github.com/chinoarror/class-schedule/blob/master/src/worker/emails.ts"
click node_webhooks "https://github.com/chinoarror/class-schedule/blob/master/src/worker/webhooks.ts"
click node_queue "https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts"
click node_extensionui "https://github.com/chinoarror/class-schedule/blob/master/extension/src/ehall-notice.js"
click node_parser "https://github.com/chinoarror/class-schedule/blob/master/extension/src/bk-kq-parser.js"
click node_background "https://github.com/chinoarror/class-schedule/blob/master/extension/src/background.js"
click node_session "https://github.com/chinoarror/class-schedule/blob/master/extension/src/background.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_app,node_term,node_schedule,node_todos,node_notes,node_sharing,node_reminderui,node_browser toneBlue
class node_worker,node_auth,node_state,node_attachments,node_shares toneAmber
class node_scheduler,node_email,node_webhooks,node_queue toneMint
class node_extensionui,node_parser,node_background,node_session toneRose
class node_student,node_authcenter,node_providers,node_school toneIndigo
```

## Components

### Student workspace

- [CampusFlow UI](https://github.com/chinoarror/class-schedule/blob/master/src/web/App.tsx): `src/web/App.tsx`
- [Term calendar](https://github.com/chinoarror/class-schedule/blob/master/src/shared/term.ts): `src/shared/term.ts`
- [Schedules](https://github.com/chinoarror/class-schedule/tree/master/src/web): `src/web`
- [Todo list](https://github.com/chinoarror/class-schedule/tree/master/src/web): `src/web`
- [Notes and files](https://github.com/chinoarror/class-schedule/tree/master/src/web): `src/web`
- [Schedule sharing](https://github.com/chinoarror/class-schedule/tree/master/src/web): `src/web`
- [Reminder settings](https://github.com/chinoarror/class-schedule/blob/master/src/web/App.tsx): `src/web/App.tsx`

### Worker services

- [API and jobs](https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts): `src/worker/index.ts`
- [Auth verification](https://github.com/chinoarror/class-schedule/blob/master/src/worker/auth.ts): `src/worker/auth.ts`
- [User state](https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts): `src/worker/index.ts`
- [Attachment storage](https://github.com/chinoarror/class-schedule/tree/master/src/web): `src/web`
- [Share records](https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts): `src/worker/index.ts`

### Notifications

- [Reminder dispatch](https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts): `src/worker/index.ts`
- [Email channel](https://github.com/chinoarror/class-schedule/blob/master/src/worker/emails.ts): `src/worker/emails.ts`
- [Webhook channels](https://github.com/chinoarror/class-schedule/blob/master/src/worker/webhooks.ts): `src/worker/webhooks.ts`
- [Delivery queue](https://github.com/chinoarror/class-schedule/blob/master/src/worker/index.ts): `src/worker/index.ts`

### Schedule import

- [Import panel](https://github.com/chinoarror/class-schedule/blob/master/extension/src/ehall-notice.js): `extension/src/ehall-notice.js`
- [BK-KQ parser](https://github.com/chinoarror/class-schedule/blob/master/extension/src/bk-kq-parser.js): `extension/src/bk-kq-parser.js`
- [Preview staging](https://github.com/chinoarror/class-schedule/blob/master/extension/src/background.js): `extension/src/background.js`
- [Extension session](https://github.com/chinoarror/class-schedule/blob/master/extension/src/background.js): `extension/src/background.js`

### Other components

- **Student**
- **Browser**
- **Auth Center**
- **Delivery providers**
- **XJTU schedule page**

## Connections

- Student → CampusFlow UI: uses
- CampusFlow UI → Term calendar: gets term dates
- CampusFlow UI → API and jobs: calls API
- API and jobs → Auth verification: verifies token
- Auth verification → Auth Center: checks identity
- API and jobs → User state: reads and writes state
- API and jobs → Share records: reads and writes shares
- CampusFlow UI → Schedules: shows schedule
- CampusFlow UI → Todo list: shows tasks
- CampusFlow UI → Schedule sharing: offers sharing
- CampusFlow UI → Reminder settings: configures reminders
- CampusFlow UI → Notes and files: offers notes
- CampusFlow UI → Attachment storage: uploads attachments
- API and jobs → Reminder dispatch: runs scheduled checks
- Reminder dispatch → User state: reads schedules and tasks
- Reminder dispatch → Delivery queue: enqueues deliveries
- Delivery queue → Webhook channels: dispatches events
- Webhook channels → Delivery providers: sends webhook events
- Reminder dispatch → Email channel: prepares email
- Email channel → Delivery providers: sends mail
- Student → Import panel: starts import
- XJTU schedule page → Import panel: provides page
- Import panel → BK-KQ parser: parses BK-KQ page
- Import panel → Preview staging: stores preview
- Preview staging → Extension session: writes and reads preview
- Browser → CampusFlow UI: returns to confirm
