# ryanruiliu/study-pilot architecture

> Architecture diagram of the GitHub repository ryanruiliu/study-pilot, 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/ryanruiliu/study-pilot
- Repository: https://github.com/ryanruiliu/study-pilot

## Overview

Study Pilot is a local browser extension that consolidates unfinished course work, deadlines, and status for a user already signed in to icourse163.org. Its main cycle loads selected courses, refreshes and stores a local snapshot when needed, derives automatic versus user-only actions, and presents the resulting to-do list. Background jobs can submit eligible quizzes and peer/self evaluations; page features separately assist with objective answers and show scoring guidance. README documents reminders and safeguards; unsampled implementation details and uncertain call wiring are not expanded.

Main entry points: [`apps/extension/entrypoints/background.ts`](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/background.ts) (Background worker), [`packages/platform-mooc/src/client.ts`](https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/client.ts) (MOOC client), [`apps/extension/entrypoints/popup/main.ts`](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/popup/main.ts) (To-do popup), [`apps/extension/entrypoints/options/main.ts`](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/options/main.ts) (Settings page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Extension UI"]
  node_popup["To-do popup<br/>[main.ts]"]
  node_options["Settings page<br/>[main.ts]"]
  node_content["MOOC page script<br/>[mooc.content.ts]"]
  node_quizhelper["Quiz assistance<br/>[quiz-helper.ts]"]
  node_featureindex["Page features<br/>[index.ts]"]
end

subgraph group_background["Task management"]
  node_backgroundentry["Background worker<br/>[background.ts]"]
  node_scheduler["Run scheduling<br/>[scheduler.ts]"]
  node_snapshot[("Work snapshot<br/>[snapshot.ts]")]
  node_planning["Action planning<br/>[task-plan.ts]"]
  node_execution["Task execution"]
  node_reminders["Desktop reminders<br/>[reminder.ts]"]
  node_settings[("Settings storage<br/>[storage.ts]")]
end

subgraph group_site["MOOC integration"]
  node_session["Session access<br/>[mooc-session.ts]"]
  node_moocclient["MOOC client<br/>[client.ts]"]
  node_courses["Course and work data<br/>[courses.ts]"]
  node_quizapi["Quiz operations<br/>[quiz.ts]"]
  node_reviewapi["Review operations<br/>[review.ts]"]
  node_structure["Course structure<br/>[structure.ts]"]
end

subgraph group_protocol["HTTP protocol"]
  node_transport["RPC and DWR<br/>[index.ts]"]
end

node_user(("Student"))
node_platform{{"icourse163.org"}}
node_localstore[("Browser local storage")]

node_user -->|"opens"| node_popup
node_user -->|"configures"| node_options
node_user -->|"opens course page"| node_content
node_popup -->|"requests status and tasks"| node_backgroundentry
node_options -->|"requests refresh or run"| node_backgroundentry
node_options -->|"reads and updates"| node_settings
node_popup -->|"reads settings"| node_settings
node_backgroundentry -->|"checks run eligibility"| node_scheduler
node_backgroundentry -->|"ensures login session"| node_session
node_backgroundentry -->|"reads and refreshes"| node_snapshot
node_backgroundentry -->|"derives task plan"| node_planning
node_backgroundentry -->|"dispatches eligible tasks"| node_execution
node_backgroundentry -->|"dispatches notifications"| node_reminders
node_execution -->|"submits eligible quizzes"| node_quizapi
node_execution -->|"submits reviews and self-evaluations"| node_reviewapi
node_backgroundentry -->|"fetches courses and work"| node_courses
node_backgroundentry -->|"reads configuration"| node_settings
node_snapshot -->|"reads and writes snapshot"| node_localstore
node_settings -->|"reads and writes settings"| node_localstore
node_popup -->|"reads pending work"| node_snapshot
node_backgroundentry -->|"creates platform client"| node_moocclient
node_moocclient -->|"uses RPC and DWR"| node_transport
node_courses -->|"calls platform client"| node_moocclient
node_quizapi -->|"calls platform client"| node_moocclient
node_reviewapi -->|"calls platform client"| node_moocclient
node_moocclient -->|"sends platform requests"| node_platform
node_platform -->|"returns course and task data"| node_moocclient
node_session -->|"uses browser session"| node_platform
node_content -->|"starts page features"| node_featureindex
node_featureindex -->|"enables quiz assistance"| node_quizhelper
node_quizhelper -->|"loads answers and quiz data"| node_quizapi
node_quizhelper -->|"page actions use signed-in account"| node_platform
node_options -->|"requests course refresh"| node_courses
node_execution -->|"updates work state"| node_snapshot

click node_popup "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/popup/main.ts"
click node_options "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/options/main.ts"
click node_content "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/mooc.content.ts"
click node_quizhelper "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/features/quiz-helper.ts"
click node_featureindex "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/features/index.ts"
click node_backgroundentry "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/background.ts"
click node_scheduler "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/scheduler.ts"
click node_snapshot "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/snapshot.ts"
click node_planning "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/task-plan.ts"
click node_execution "https://github.com/ryanruiliu/study-pilot/tree/main/apps/extension/src/background"
click node_reminders "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/reminder.ts"
click node_settings "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/settings/storage.ts"
click node_session "https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/platform/mooc-session.ts"
click node_moocclient "https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/client.ts"
click node_courses "https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/courses.ts"
click node_quizapi "https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/quiz.ts"
click node_reviewapi "https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/review.ts"
click node_structure "https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/structure.ts"
click node_transport "https://github.com/ryanruiliu/study-pilot/blob/main/packages/transport/src/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_popup,node_options,node_content,node_quizhelper,node_featureindex toneBlue
class node_backgroundentry,node_scheduler,node_snapshot,node_planning,node_execution,node_reminders,node_settings,node_localstore toneAmber
class node_session,node_moocclient,node_courses,node_quizapi,node_reviewapi,node_structure toneMint
class node_transport toneRose
class node_user,node_platform toneIndigo
```

## Components

### Extension UI

- [To-do popup](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/popup/main.ts): `apps/extension/entrypoints/popup/main.ts`
- [Settings page](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/options/main.ts): `apps/extension/entrypoints/options/main.ts`
- [MOOC page script](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/mooc.content.ts): `apps/extension/entrypoints/mooc.content.ts`
- [Quiz assistance](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/features/quiz-helper.ts): `apps/extension/src/features/quiz-helper.ts`
- [Page features](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/features/index.ts): `apps/extension/src/features/index.ts`

### Task management

- [Background worker](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/entrypoints/background.ts): `apps/extension/entrypoints/background.ts`
- [Run scheduling](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/scheduler.ts): `apps/extension/src/background/scheduler.ts`
- [Work snapshot](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/snapshot.ts): `apps/extension/src/background/snapshot.ts`
- [Action planning](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/task-plan.ts): `apps/extension/src/background/task-plan.ts`
- [Task execution](https://github.com/ryanruiliu/study-pilot/tree/main/apps/extension/src/background): `apps/extension/src/background`
- [Desktop reminders](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/background/reminder.ts): `apps/extension/src/background/reminder.ts`
- [Settings storage](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/settings/storage.ts): `apps/extension/src/settings/storage.ts`

### MOOC integration

- [Session access](https://github.com/ryanruiliu/study-pilot/blob/main/apps/extension/src/platform/mooc-session.ts): `apps/extension/src/platform/mooc-session.ts`
- [MOOC client](https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/client.ts): `packages/platform-mooc/src/client.ts`
- [Course and work data](https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/courses.ts): `packages/platform-mooc/src/courses.ts`
- [Quiz operations](https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/quiz.ts): `packages/platform-mooc/src/quiz.ts`
- [Review operations](https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/review.ts): `packages/platform-mooc/src/review.ts`
- [Course structure](https://github.com/ryanruiliu/study-pilot/blob/main/packages/platform-mooc/src/structure.ts): `packages/platform-mooc/src/structure.ts`

### HTTP protocol

- [RPC and DWR](https://github.com/ryanruiliu/study-pilot/blob/main/packages/transport/src/index.ts): `packages/transport/src/index.ts`

### Other components

- **Student**
- **icourse163.org**
- **Browser local storage**

## Connections

- Student → To-do popup: opens
- Student → Settings page: configures
- Student → MOOC page script: opens course page
- To-do popup → Background worker: requests status and tasks
- Settings page → Background worker: requests refresh or run
- Settings page → Settings storage: reads and updates
- To-do popup → Settings storage: reads settings
- Background worker → Run scheduling: checks run eligibility
- Background worker → Session access: ensures login session
- Background worker → Work snapshot: reads and refreshes
- Background worker → Action planning: derives task plan
- Background worker → Task execution: dispatches eligible tasks
- Background worker → Desktop reminders: dispatches notifications
- Task execution → Quiz operations: submits eligible quizzes
- Task execution → Review operations: submits reviews and self-evaluations
- Background worker → Course and work data: fetches courses and work
- Background worker → Settings storage: reads configuration
- Work snapshot → Browser local storage: reads and writes snapshot
- Settings storage → Browser local storage: reads and writes settings
- To-do popup → Work snapshot: reads pending work
- Background worker → MOOC client: creates platform client
- MOOC client → RPC and DWR: uses RPC and DWR
- Course and work data → MOOC client: calls platform client
- Quiz operations → MOOC client: calls platform client
- Review operations → MOOC client: calls platform client
- MOOC client → icourse163.org: sends platform requests
- icourse163.org → MOOC client: returns course and task data
- Session access → icourse163.org: uses browser session
- MOOC page script → Page features: starts page features
- Page features → Quiz assistance: enables quiz assistance
- Quiz assistance → Quiz operations: loads answers and quiz data
- Quiz assistance → icourse163.org: page actions use signed-in account
- Settings page → Course and work data: requests course refresh
- Task execution → Work snapshot: updates work state
