# jintairezhao/school-watcher architecture

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

- Interactive diagram: https://gitdiagram.com/jintairezhao/school-watcher
- Repository: https://github.com/jintairezhao/school-watcher

## Overview

School Watcher is a local desktop app for following university notices: users select schools, the system discovers publication sources, collects notices, and presents them in a searchable inbox. Its durable task queue and worker support background discovery, collection, and maintenance. Optional AI assists source identification and user-requested summaries; browser-based fetching is available for dynamic pages. The graph combines README-documented capabilities with sampled source references. Many route and service implementations were not excerpted, so some subsystem links are documented at a high level rather than traced through every call.

Main entry points: [`backend/scraper/engine.py`](https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/engine.py) (Scrape engine), [`backend/services/discovery.py`](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/discovery.py) (Source discovery), [`backend/database/models.py`](https://github.com/jintairezhao/school-watcher/blob/main/backend/database/models.py) (Local database), [`backend/worker.py`](https://github.com/jintairezhao/school-watcher/blob/main/backend/worker.py) (Background worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_desktop_app["Desktop window<br/>[window.py]"]
  node_app_entry["App entry<br/>[app.py]"]
  node_frontend["Inbox interface<br/>[app.js]"]
end

subgraph group_discovery["Source discovery"]
  node_school_catalog["School catalog<br/>[school_registry.py]"]
  node_discovery_flow["Source discovery<br/>[discovery.py]"]
  node_source_governance["Source governance"]
  node_source_inventory["Source inventory"]
  node_discovery_control["Discovery control"]
  node_discovery_policy["Discovery policy"]
  node_ai_runtime["AI runtime<br/>[runtime.py]"]
end

subgraph group_collection["Notice collection"]
  node_scrape_engine["Scrape engine<br/>[engine.py]"]
  node_http_client["HTTP fetching<br/>[http_client.py]"]
  node_browser_service["Browser fetching"]
  node_change_detection["Change detection<br/>[change_detector.py]"]
  node_title_quality["Title validation<br/>[title_quality.py]"]
  node_publication_lists["List discovery"]
end

subgraph group_reading["Inbox and AI"]
  node_ai_configuration["AI configuration<br/>[configuration.py]"]
  node_inbox_refresh["Inbox refresh<br/>[inbox_refresh.py]"]
  node_search_route["Notice search<br/>[search.py]"]
  node_summaries["AI summaries<br/>[summaries.py]"]
end

subgraph group_runtime["Runtime and data"]
  node_task_queue["Durable task queue<br/>[tasks.py]"]
  node_worker["Background worker<br/>[worker.py]"]
  node_storage_policy["Storage policy<br/>[storage_policy.py]"]
  node_runtime_catalog["Runtime catalog<br/>[runtime_catalog.py]"]
  node_database[("Local database<br/>[models.py]")]
end

node_user(("Local user"))

node_user -->|"uses"| node_desktop_app
node_app_entry -->|"starts"| node_desktop_app
node_desktop_app -->|"opens interface"| node_frontend
node_user -->|"follows schools"| node_school_catalog
node_school_catalog -->|"starts discovery"| node_discovery_flow
node_discovery_flow -.->|"validates sources"| node_source_governance
node_discovery_flow -.->|"records findings"| node_source_inventory
node_discovery_flow -.->|"queues work"| node_task_queue
node_discovery_control -.->|"controls discovery"| node_discovery_flow
node_discovery_policy -->|"limits usage"| node_ai_runtime
node_ai_configuration -.->|"configures"| node_ai_runtime
node_ai_runtime -->|"assists discovery"| node_discovery_flow
node_worker -->|"claims tasks"| node_task_queue
node_worker -.->|"collects notices"| node_scrape_engine
node_scrape_engine -->|"fetches pages"| node_http_client
node_scrape_engine -.->|"uses browser"| node_browser_service
node_scrape_engine -->|"checks changes"| node_change_detection
node_scrape_engine -->|"validates titles"| node_title_quality
node_scrape_engine -->|"finds lists"| node_publication_lists
node_worker -->|"refreshes inbox"| node_inbox_refresh
node_frontend -.->|"searches notices"| node_search_route
node_search_route -->|"loads summaries"| node_summaries
node_user -->|"requests summary"| node_summaries
node_scrape_engine -->|"stores notices"| node_database
node_search_route -->|"queries notices"| node_database
node_storage_policy -->|"stores policy"| node_database
node_runtime_catalog -.->|"persists catalog"| node_database

click node_desktop_app "https://github.com/jintairezhao/school-watcher/blob/main/desktop/window.py"
click node_app_entry "https://github.com/jintairezhao/school-watcher/blob/main/app.py"
click node_frontend "https://github.com/jintairezhao/school-watcher/blob/main/frontend/static/js/app.js"
click node_school_catalog "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/school_registry.py"
click node_discovery_flow "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/discovery.py"
click node_source_governance "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/source_governance.py"
click node_source_inventory "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/source_inventory.py"
click node_discovery_control "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/discovery_control.py"
click node_discovery_policy "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/discovery_policy.py"
click node_ai_runtime "https://github.com/jintairezhao/school-watcher/blob/main/backend/ai/runtime.py"
click node_ai_configuration "https://github.com/jintairezhao/school-watcher/blob/main/backend/ai/configuration.py"
click node_task_queue "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/tasks.py"
click node_worker "https://github.com/jintairezhao/school-watcher/blob/main/backend/worker.py"
click node_scrape_engine "https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/engine.py"
click node_http_client "https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/http_client.py"
click node_browser_service "https://github.com/jintairezhao/school-watcher/tree/main/backend/browser_service"
click node_change_detection "https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/change_detector.py"
click node_title_quality "https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/detectors/title_quality.py"
click node_publication_lists "https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/discovery/publication_lists.py"
click node_inbox_refresh "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/inbox_refresh.py"
click node_search_route "https://github.com/jintairezhao/school-watcher/blob/main/backend/routes/search.py"
click node_summaries "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/summaries.py"
click node_storage_policy "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/storage_policy.py"
click node_runtime_catalog "https://github.com/jintairezhao/school-watcher/blob/main/backend/services/runtime_catalog.py"
click node_database "https://github.com/jintairezhao/school-watcher/blob/main/backend/database/models.py"

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_desktop_app,node_app_entry,node_frontend,node_user toneBlue
class node_school_catalog,node_discovery_flow,node_source_governance,node_source_inventory,node_discovery_control,node_discovery_policy,node_ai_runtime toneAmber
class node_scrape_engine,node_http_client,node_browser_service,node_change_detection,node_title_quality,node_publication_lists toneMint
class node_ai_configuration,node_inbox_refresh,node_search_route,node_summaries toneRose
class node_task_queue,node_worker,node_storage_policy,node_runtime_catalog,node_database toneIndigo
```

## Components

### Desktop experience

- [Desktop window](https://github.com/jintairezhao/school-watcher/blob/main/desktop/window.py): `desktop/window.py`
- [App entry](https://github.com/jintairezhao/school-watcher/blob/main/app.py): `app.py`
- [Inbox interface](https://github.com/jintairezhao/school-watcher/blob/main/frontend/static/js/app.js): `frontend/static/js/app.js`

### Source discovery

- [School catalog](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/school_registry.py): `backend/services/school_registry.py`
- [Source discovery](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/discovery.py): `backend/services/discovery.py`
- [Source governance](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/source_governance.py): `backend/services/source_governance.py`
- [Source inventory](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/source_inventory.py): `backend/services/source_inventory.py`
- [Discovery control](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/discovery_control.py): `backend/services/discovery_control.py`
- [Discovery policy](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/discovery_policy.py): `backend/services/discovery_policy.py`
- [AI runtime](https://github.com/jintairezhao/school-watcher/blob/main/backend/ai/runtime.py): `backend/ai/runtime.py`

### Notice collection

- [Scrape engine](https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/engine.py): `backend/scraper/engine.py`
- [HTTP fetching](https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/http_client.py): `backend/scraper/http_client.py`
- [Browser fetching](https://github.com/jintairezhao/school-watcher/tree/main/backend/browser_service): `backend/browser_service`
- [Change detection](https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/change_detector.py): `backend/scraper/change_detector.py`
- [Title validation](https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/detectors/title_quality.py): `backend/scraper/detectors/title_quality.py`
- [List discovery](https://github.com/jintairezhao/school-watcher/blob/main/backend/scraper/discovery/publication_lists.py): `backend/scraper/discovery/publication_lists.py`

### Inbox and AI

- [AI configuration](https://github.com/jintairezhao/school-watcher/blob/main/backend/ai/configuration.py): `backend/ai/configuration.py`
- [Inbox refresh](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/inbox_refresh.py): `backend/services/inbox_refresh.py`
- [Notice search](https://github.com/jintairezhao/school-watcher/blob/main/backend/routes/search.py): `backend/routes/search.py`
- [AI summaries](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/summaries.py): `backend/services/summaries.py`

### Runtime and data

- [Durable task queue](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/tasks.py): `backend/services/tasks.py`
- [Background worker](https://github.com/jintairezhao/school-watcher/blob/main/backend/worker.py): `backend/worker.py`
- [Storage policy](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/storage_policy.py): `backend/services/storage_policy.py`
- [Runtime catalog](https://github.com/jintairezhao/school-watcher/blob/main/backend/services/runtime_catalog.py): `backend/services/runtime_catalog.py`
- [Local database](https://github.com/jintairezhao/school-watcher/blob/main/backend/database/models.py): `backend/database/models.py`

### Other components

- **Local user**

## Connections

- Local user → Desktop window: uses (evidence: `README.md`)
- App entry → Desktop window: starts (evidence: `app.py`)
- Desktop window → Inbox interface: opens interface (evidence: `README.md`)
- Local user → School catalog: follows schools (evidence: `README.md`)
- School catalog → Source discovery: starts discovery (evidence: `README.md`)
- Source discovery → Source governance: validates sources
- Source discovery → Source inventory: records findings
- Source discovery → Durable task queue: queues work
- Discovery control → Source discovery: controls discovery
- Discovery policy → AI runtime: limits usage (evidence: `backend/ai/runtime.py`)
- AI configuration → AI runtime: configures (evidence: `backend/ai/runtime.py`)
- AI runtime → Source discovery: assists discovery (evidence: `README.md`)
- Background worker → Durable task queue: claims tasks (evidence: `backend/worker.py`)
- Background worker → Scrape engine: collects notices (evidence: `backend/worker.py`)
- Scrape engine → HTTP fetching: fetches pages (evidence: `backend/scraper/engine.py`)
- Scrape engine → Browser fetching: uses browser (evidence: `README.md`)
- Scrape engine → Change detection: checks changes (evidence: `backend/scraper/engine.py`)
- Scrape engine → Title validation: validates titles (evidence: `backend/scraper/engine.py`)
- Scrape engine → List discovery: finds lists (evidence: `backend/scraper/engine.py`)
- Background worker → Inbox refresh: refreshes inbox (evidence: `backend/worker.py`)
- Inbox interface → Notice search: searches notices
- Notice search → AI summaries: loads summaries (evidence: `backend/routes/search.py`)
- Local user → AI summaries: requests summary (evidence: `README.md`)
- Scrape engine → Local database: stores notices (evidence: `backend/scraper/engine.py`)
- Notice search → Local database: queries notices (evidence: `backend/routes/search.py`)
- Storage policy → Local database: stores policy (evidence: `backend/services/storage_policy.py`)
- Runtime catalog → Local database: persists catalog
