# unweidlykhan349/sbreader architecture

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

- Interactive diagram: https://gitdiagram.com/unweidlykhan349/sbreader
- Repository: https://github.com/unweidlykhan349/sbreader

## Overview

SB Reader is a static Science Bowl practice site. A learner searches the question catalog or opens Play, selects a set or question mode, reads and answers questions, then can review or star them; multiplayer extends practice to online rooms. Major branches include tournament and packet browsing, accounts and progress, reports, and question statistics. Optional Supabase services support accounts, room listings/relay, and reports; stars are kept per device. Relationships below are limited to README statements and shown source calls; unsampled wiring is not inferred.

Main entry points: [`js/solo.js`](https://github.com/unweidlykhan349/sbreader/blob/main/js/solo.js) (Solo Trainer), [`js/multiplayer.js`](https://github.com/unweidlykhan349/sbreader/blob/main/js/multiplayer.js) (Multiplayer Rooms), [`js/stats.js`](https://github.com/unweidlykhan349/sbreader/blob/main/js/stats.js) (Question Statistics), [`js/data.js`](https://github.com/unweidlykhan349/sbreader/blob/main/js/data.js) (Shared Data Layer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Practice and Play"]
  node_solo["Solo Trainer<br/>[solo.js]"]
  node_reveal["Question Reveal<br/>[reveal.js]"]
  node_answercheck["Answer Grading<br/>[answer-check.js]"]
  node_multiplayer["Multiplayer Rooms<br/>[multiplayer.js]"]
  node_mprooms["Room Listing<br/>[rooms.js]"]
  node_peer["Peer Connections<br/>[peer.js]"]
  node_mprules["Multiplayer Rules<br/>[mp-rules.js]"]
end

subgraph group_library["Question Library"]
  node_catalog["Question Catalog<br/>[catalog.js]"]
  node_bank[("Question Bank<br/>[index.json]")]
  node_setpages["Set and Packet Pages<br/>[set-pages.js]"]
end

subgraph group_identity["Accounts and Progress"]
  node_stars["Starred Questions<br/>[stars.js]"]
  node_accounts["Account Service<br/>[account-core.js]"]
  node_authpages["Sign-in Pages<br/>[auth-pages.js]"]
  node_accountpage["Account Page<br/>[account-page.js]"]
  node_account["Account UI<br/>[account.js]"]
  node_stats["Question Statistics<br/>[stats.js]"]
  node_userstats["User Progress<br/>[user-stats.js]"]
  node_graphs["Statistics Graphs<br/>[graphs.js]"]
  node_questionstats["Question Stats Logic<br/>[question-stats.js]"]
end

subgraph group_services["Optional Services"]
  node_reports["Question Reports<br/>[reports.js]"]
  node_supabase[("Supabase<br/>[schema.sql]")]
  node_turn["TURN Credentials<br/>[index.ts]"]
end

subgraph group_shared["Shared Runtime"]
  node_home["Home and Site<br/>[site.js]"]
  node_data["Shared Data Layer<br/>[data.js]"]
  node_playcommon["Play Utilities<br/>[play-common.js]"]
  node_config["Site Configuration<br/>[config.js]"]
  node_frequency["Frequency Lists<br/>[frequency-list.js]"]
end

node_learner(("Learner"))

node_learner -->|"searches"| node_catalog
node_catalog -->|"searches"| node_bank
node_learner -->|"practices"| node_solo
node_solo -->|"loads questions"| node_data
node_solo -->|"starts reveal"| node_reveal
node_learner -->|"browses sets"| node_setpages
node_setpages -->|"loads set"| node_bank
node_learner -->|"joins room"| node_multiplayer
node_multiplayer -.->|"connects peers"| node_peer
node_multiplayer -->|"uses rules"| node_mprules
node_learner -->|"stars questions"| node_stars
node_learner -->|"signs in"| node_authpages
node_authpages -->|"submits credentials"| node_accounts
node_account -.->|"uses account service"| node_accounts
node_learner -->|"reports question"| node_reports
node_reports -.->|"sends reports"| node_supabase
node_mprooms -.->|"uses room services"| node_supabase
node_multiplayer -.->|"requests TURN login"| node_turn
node_data -->|"loads question data"| node_bank
node_solo -.->|"uses play helpers"| node_playcommon
node_learner -->|"reviews statistics"| node_stats
node_stats -.->|"renders graphs"| node_graphs
node_stats -.->|"uses question stats"| node_questionstats
node_learner -->|"views account"| node_accountpage
node_accountpage -.->|"shows progress"| node_userstats
node_data -.->|"provides frequency data"| node_frequency
node_home -.->|"uses configuration"| node_config

click node_home "https://github.com/unweidlykhan349/sbreader/blob/main/js/site.js"
click node_catalog "https://github.com/unweidlykhan349/sbreader/blob/main/js/catalog.js"
click node_bank "https://github.com/unweidlykhan349/sbreader/blob/main/data/bank/index.json"
click node_setpages "https://github.com/unweidlykhan349/sbreader/blob/main/js/set-pages.js"
click node_solo "https://github.com/unweidlykhan349/sbreader/blob/main/js/solo.js"
click node_reveal "https://github.com/unweidlykhan349/sbreader/blob/main/js/reveal.js"
click node_answercheck "https://github.com/unweidlykhan349/sbreader/blob/main/js/answer-check.js"
click node_multiplayer "https://github.com/unweidlykhan349/sbreader/blob/main/js/multiplayer.js"
click node_mprooms "https://github.com/unweidlykhan349/sbreader/blob/main/js/rooms.js"
click node_peer "https://github.com/unweidlykhan349/sbreader/blob/main/js/peer.js"
click node_mprules "https://github.com/unweidlykhan349/sbreader/blob/main/js/mp-rules.js"
click node_stars "https://github.com/unweidlykhan349/sbreader/blob/main/js/stars.js"
click node_accounts "https://github.com/unweidlykhan349/sbreader/blob/main/js/account-core.js"
click node_authpages "https://github.com/unweidlykhan349/sbreader/blob/main/js/auth-pages.js"
click node_accountpage "https://github.com/unweidlykhan349/sbreader/blob/main/js/account-page.js"
click node_account "https://github.com/unweidlykhan349/sbreader/blob/main/js/account.js"
click node_stats "https://github.com/unweidlykhan349/sbreader/blob/main/js/stats.js"
click node_userstats "https://github.com/unweidlykhan349/sbreader/blob/main/js/user-stats.js"
click node_reports "https://github.com/unweidlykhan349/sbreader/blob/main/js/reports.js"
click node_supabase "https://github.com/unweidlykhan349/sbreader/blob/main/supabase/schema.sql"
click node_turn "https://github.com/unweidlykhan349/sbreader/blob/main/supabase/functions/turn-credentials/index.ts"
click node_data "https://github.com/unweidlykhan349/sbreader/blob/main/js/data.js"
click node_playcommon "https://github.com/unweidlykhan349/sbreader/blob/main/js/play-common.js"
click node_config "https://github.com/unweidlykhan349/sbreader/blob/main/js/config.js"
click node_frequency "https://github.com/unweidlykhan349/sbreader/blob/main/js/frequency-list.js"
click node_graphs "https://github.com/unweidlykhan349/sbreader/blob/main/js/graphs.js"
click node_questionstats "https://github.com/unweidlykhan349/sbreader/blob/main/js/question-stats.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_solo,node_reveal,node_answercheck,node_multiplayer,node_mprooms,node_peer,node_mprules toneBlue
class node_catalog,node_bank,node_setpages toneAmber
class node_stars,node_accounts,node_authpages,node_accountpage,node_account,node_stats,node_userstats,node_graphs,node_questionstats toneMint
class node_reports,node_supabase,node_turn toneRose
class node_home,node_data,node_playcommon,node_config,node_frequency,node_learner toneIndigo
```

## Components

### Practice and Play

- [Solo Trainer](https://github.com/unweidlykhan349/sbreader/blob/main/js/solo.js): `js/solo.js`
- [Question Reveal](https://github.com/unweidlykhan349/sbreader/blob/main/js/reveal.js): `js/reveal.js`
- [Answer Grading](https://github.com/unweidlykhan349/sbreader/blob/main/js/answer-check.js): `js/answer-check.js`
- [Multiplayer Rooms](https://github.com/unweidlykhan349/sbreader/blob/main/js/multiplayer.js): `js/multiplayer.js`
- [Room Listing](https://github.com/unweidlykhan349/sbreader/blob/main/js/rooms.js): `js/rooms.js`
- [Peer Connections](https://github.com/unweidlykhan349/sbreader/blob/main/js/peer.js): `js/peer.js`
- [Multiplayer Rules](https://github.com/unweidlykhan349/sbreader/blob/main/js/mp-rules.js): `js/mp-rules.js`

### Question Library

- [Question Catalog](https://github.com/unweidlykhan349/sbreader/blob/main/js/catalog.js): `js/catalog.js`
- [Question Bank](https://github.com/unweidlykhan349/sbreader/blob/main/data/bank/index.json): `data/bank/index.json`
- [Set and Packet Pages](https://github.com/unweidlykhan349/sbreader/blob/main/js/set-pages.js): `js/set-pages.js`

### Accounts and Progress

- [Starred Questions](https://github.com/unweidlykhan349/sbreader/blob/main/js/stars.js): `js/stars.js`
- [Account Service](https://github.com/unweidlykhan349/sbreader/blob/main/js/account-core.js): `js/account-core.js`
- [Sign-in Pages](https://github.com/unweidlykhan349/sbreader/blob/main/js/auth-pages.js): `js/auth-pages.js`
- [Account Page](https://github.com/unweidlykhan349/sbreader/blob/main/js/account-page.js): `js/account-page.js`
- [Account UI](https://github.com/unweidlykhan349/sbreader/blob/main/js/account.js): `js/account.js`
- [Question Statistics](https://github.com/unweidlykhan349/sbreader/blob/main/js/stats.js): `js/stats.js`
- [User Progress](https://github.com/unweidlykhan349/sbreader/blob/main/js/user-stats.js): `js/user-stats.js`
- [Statistics Graphs](https://github.com/unweidlykhan349/sbreader/blob/main/js/graphs.js): `js/graphs.js`
- [Question Stats Logic](https://github.com/unweidlykhan349/sbreader/blob/main/js/question-stats.js): `js/question-stats.js`

### Optional Services

- [Question Reports](https://github.com/unweidlykhan349/sbreader/blob/main/js/reports.js): `js/reports.js`
- [Supabase](https://github.com/unweidlykhan349/sbreader/blob/main/supabase/schema.sql): `supabase/schema.sql`
- [TURN Credentials](https://github.com/unweidlykhan349/sbreader/blob/main/supabase/functions/turn-credentials/index.ts): `supabase/functions/turn-credentials/index.ts`

### Shared Runtime

- [Home and Site](https://github.com/unweidlykhan349/sbreader/blob/main/js/site.js): `js/site.js`
- [Shared Data Layer](https://github.com/unweidlykhan349/sbreader/blob/main/js/data.js): `js/data.js`
- [Play Utilities](https://github.com/unweidlykhan349/sbreader/blob/main/js/play-common.js): `js/play-common.js`
- [Site Configuration](https://github.com/unweidlykhan349/sbreader/blob/main/js/config.js): `js/config.js`
- [Frequency Lists](https://github.com/unweidlykhan349/sbreader/blob/main/js/frequency-list.js): `js/frequency-list.js`

### Other components

- **Learner**

## Connections

- Learner → Question Catalog: searches (evidence: `README.md`)
- Question Catalog → Question Bank: searches (evidence: `README.md`)
- Learner → Solo Trainer: practices (evidence: `README.md`)
- Solo Trainer → Shared Data Layer: loads questions (evidence: `js/solo.js`)
- Solo Trainer → Question Reveal: starts reveal (evidence: `js/solo.js`)
- Learner → Set and Packet Pages: browses sets (evidence: `README.md`)
- Set and Packet Pages → Question Bank: loads set (evidence: `README.md`)
- Learner → Multiplayer Rooms: joins room (evidence: `README.md`)
- Multiplayer Rooms → Peer Connections: connects peers (evidence: `README.md`)
- Multiplayer Rooms → Multiplayer Rules: uses rules (evidence: `js/multiplayer.js`)
- Learner → Starred Questions: stars questions (evidence: `README.md`)
- Learner → Sign-in Pages: signs in (evidence: `README.md`)
- Sign-in Pages → Account Service: submits credentials (evidence: `js/auth-pages.js`)
- Account UI → Account Service: uses account service
- Learner → Question Reports: reports question (evidence: `README.md`)
- Question Reports → Supabase: sends reports (evidence: `README.md`)
- Room Listing → Supabase: uses room services (evidence: `README.md`)
- Multiplayer Rooms → TURN Credentials: requests TURN login (evidence: `README.md`)
- Shared Data Layer → Question Bank: loads question data (evidence: `README.md`)
- Solo Trainer → Play Utilities: uses play helpers
- Learner → Question Statistics: reviews statistics (evidence: `README.md`)
- Question Statistics → Statistics Graphs: renders graphs
- Question Statistics → Question Stats Logic: uses question stats
- Learner → Account Page: views account (evidence: `README.md`)
- Account Page → User Progress: shows progress
- Shared Data Layer → Frequency Lists: provides frequency data
- Home and Site → Site Configuration: uses configuration
