# chandy-bit/mathsim-platform architecture

> Architecture diagram of the GitHub repository chandy-bit/mathsim-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chandy-bit/mathsim-platform
- Repository: https://github.com/chandy-bit/mathsim-platform

## Overview

1. **Repository shape**
   - This is a **static educational web platform** centered on math learning and simulation experiences.
   - The main entry points are a set of standalone HTML pages (`index.html`, subject pages, dashboard, games, docs, policies) backed by shared CSS and JavaScript.
   - There is no obvious backend application in the tree; the only server-side artifact is `header.php`, which suggests optional server-side reuse of shared page chrome.

2. **Core presentation layer**
   - The UI is split across many HTML pages rather than a single SPA.
   - Pages are organized by purpose: learning content (`algebra.html`, `calculus.html`, `geometry.html`, `probability.html`, `precalculus.html`), interactive experiences (`game.html`, `simulation.html`, `planner.html`, `prototype.html`), dashboards (`analytic-dashboard.html`, `progress.html`, `leaderboard.html`), and supporting/legal pages (`privacy.html`, `terms.html`, `consent.html`, etc.).
   - This suggests a **multi-page application** architecture with shared assets rather than route-driven client-side navigation.

3. **Shared shell and navigation**
   - `header.php` likely provides reusable header/navigation markup across pages.
   - Shared layout and theme styling live in `css/style.css`, with feature-specific styles such as `css/consent.css` and `css/upgrade.css`.
   - The architecture likely relies on a common site shell plus page-specific content sections.

4. **Learning content subsystem**
   - Subject-specific scripts (`js/algebra.js`, `js/calculus.js`, `js/geometry.js`, `js/probability.js`) indicate dedicated logic per math domain.
   - `js/practice-questions.js`, `js/tutorials.js`, `js/solution-panel.js`, and `js/plotter.js` suggest the platform mixes explanatory content with interactive practice and visual feedback.
   - This subsystem is the main pedagogical layer: it appears to render exercises, hints, explanations, and visualizations within the subject pages.

5. **Simulation and game engine**
   - The simulation stack is more structured and separated from the subject pages: `js/simulation-core.js`, `js/simulation-types.js`, `js/simulation.js`, `js/game.js`, and `js/animations.js`.
   - This implies a reusable runtime for interactive simulations/games, with scenario-specific behavior defined by “types” and shared execution handled by the core.
   - Pages such as `simulation.html`, `game.html`, and `algebra-game.html` likely mount this engine with different content or rules.

6. **Progress, analytics, and leaderboard flow**
   - `js/progress.js`, `js/analytics.js`, `js/dashboard.js`, and `js/leaderboard.js` indicate client-side tracking and visualization of learner activity.
   - `progress.html`, `analytic-dashboard.html`, and `leaderboard.html` are the visible surfaces for this subsystem.
   - The architectural boundary here is important: user interaction data is captured in the browser, then surfaced in dashboards/leaderboards, likely with local storage or remote telemetry depending on deployment.

7. **Platform services and runtime features**
   - `js/pwa.js` and `js/service-worker.js` indicate Progressive Web App support, likely for offline availability and installability.
   - `offline.html` is the fallback/offline experience, which is typically served when network access is unavailable.
   - `manifest.json` defines app metadata for installation, icons, and startup behavior.

8. **Cross-cutting client features**
   - `js/theme.js`, `js/language.js`, `js/accessibility.js`, `js/upgrade.js`, and `js/animations.js` are cross-cutting modules affecting many pages.
   - These likely handle theme switching, localization, accessibility enhancements, UI polish, and feature gating or upgrade messaging.
   - `js/main.js` and `js/modulesloader.js` appear to coordinate shared initialization and page-specific script loading.

9. **Content, assets, and compliance boundary**
   - Static assets live under `assets/` and `css/`, with images/icons and a consent PDF.
   - The repository includes policy and consent pages (`privacy.html`, `terms.html`, `consent.html`) plus a `consent-form.pdf`, which suggests attention to user consent and compliance flows.
   - These pages are part of the public-facing content boundary, separate from interactive learning features.

10. **Information architecture and documentation**
   - Supporting pages such as `about.html`, `contact.html`, `faq.html`, `docs.html`, `user-manual.html`, `tutorial.html`, `changelog.html`, and `system-diagram.html` indicate a documentation-heavy product.
   - `sitemap.xml` and `robots.txt` show standard web publishing/SEO support.
   - The presence of `survey.html` and `feedback.html` suggests direct user input channels, though no backend is visible in the tree.

11. **Likely deployment model**
   - The repo looks designed to be deployed as a **static site or static-first web app**, possibly on a host that can optionally render PHP for shared headers.
   - Client-side JavaScript appears to do most of the work: interactivity, simulation runtime, analytics dashboards, PWA/offline behavior, and UI state management.
   - Any persistent state beyond the file system is not visible here, so diagramming should treat storage as browser-side or external/implicit rather than repo-defined.

12. **How to draw the architecture**
   - At the center, show a **browser-based multi-page learning platform**.
   - Surround it with shared client modules for learning content, simulation/game runtime, progress/analytics, and platform services like PWA/offline/theme/accessibility.
   - Connect all HTML pages to the shared CSS/JS layer, with subject pages feeding the learning engine, and dashboard/progress pages consuming tracked user activity.
   - Show static hosting as the main delivery mechanism, with `header.php` as an optional shared template boundary if server-side includes are used.

Main entry points: [`js/modulesloader.js`](https://github.com/chandy-bit/mathsim-platform/blob/main/js/modulesloader.js) (Module loader), [`js/main.js`](https://github.com/chandy-bit/mathsim-platform/blob/main/js/main.js) (App init), [`header.php`](https://github.com/chandy-bit/mathsim-platform/blob/main/header.php) (Header), [`css/style.css`](https://github.com/chandy-bit/mathsim-platform/blob/main/css/style.css) (Base styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation pages"]
  node_index["Home<br/>entry page<br/>[index.html]"]
  node_subject_pages["Subjects<br/>content pages"]
  node_experience_pages["Interactive<br/>experience pages"]
  node_docs_pages["Docs & policy<br/>support pages"]
end

subgraph group_learning["Learning engine"]
  node_learning_modules["Learning modules<br/>subject logic"]
  node_plotter_js["Plotter<br/>visualization<br/>[plotter.js]"]
end

subgraph group_simulation["Simulation runtime"]
  node_simulation_core["Sim core<br/>runtime core<br/>[simulation-core.js]"]
  node_simulation_types["Sim types<br/>scenario models"]
  node_game_js["Game logic<br/>interactive runtime<br/>[game.js]"]
end

subgraph group_insights["Insights"]
  node_dashboard_pages["Dashboards<br/>status pages"]
  node_insights_modules["Tracking<br/>analytics modules"]
end

subgraph group_platform["Platform services"]
  node_header_php["Header<br/>shared template<br/>[header.php]"]
  node_style_css["Base styles<br/>stylesheet<br/>[style.css]"]
  node_page_styles["Page styles<br/>feature stylesheets"]
  node_main_js["App init<br/>bootstrap script<br/>[main.js]"]
  node_modulesloader_js["Module loader<br/>[modulesloader.js]"]
  node_platform_features["Platform features<br/>cross-cutting modules"]
  node_service_worker["Service worker<br/>offline runtime<br/>[service-worker.js]"]
  node_manifest_json["Manifest<br/>web app metadata<br/>[manifest.json]"]
  node_offline_page["Offline<br/>fallback page<br/>[offline.html]"]
end

node_index -->|"uses"| node_style_css
node_index -->|"boots"| node_main_js
node_subject_pages -->|"uses"| node_style_css
node_subject_pages -->|"boots"| node_main_js
node_experience_pages -->|"uses"| node_style_css
node_experience_pages -->|"boots"| node_main_js
node_dashboard_pages -->|"uses"| node_style_css
node_dashboard_pages -->|"boots"| node_main_js
node_docs_pages -->|"uses"| node_style_css
node_docs_pages -->|"boots"| node_main_js
node_header_php -.->|"shared chrome"| node_index
node_header_php -.->|"shared chrome"| node_subject_pages
node_header_php -.->|"shared chrome"| node_experience_pages
node_header_php -.->|"shared chrome"| node_dashboard_pages
node_header_php -.->|"shared chrome"| node_docs_pages
node_main_js -->|"delegates"| node_modulesloader_js
node_modulesloader_js -->|"loads"| node_learning_modules
node_modulesloader_js -->|"loads"| node_simulation_core
node_modulesloader_js -->|"loads"| node_game_js
node_modulesloader_js -->|"loads"| node_insights_modules
node_modulesloader_js -->|"loads"| node_platform_features
node_learning_modules -->|"visualizes"| node_plotter_js
node_learning_modules -->|"powers"| node_subject_pages
node_simulation_core -->|"configures"| node_simulation_types
node_simulation_core -->|"powers"| node_experience_pages
node_game_js -->|"extends"| node_simulation_core
node_insights_modules -->|"powers"| node_dashboard_pages
node_platform_features -->|"coordinates"| node_style_css
node_service_worker -->|"falls back to"| node_offline_page
node_service_worker -.->|"supports"| node_manifest_json
node_platform_features -->|"registers"| node_service_worker
node_platform_features -.->|"supports"| node_manifest_json

click node_index "https://github.com/chandy-bit/mathsim-platform/blob/main/index.html"
click node_header_php "https://github.com/chandy-bit/mathsim-platform/blob/main/header.php"
click node_style_css "https://github.com/chandy-bit/mathsim-platform/blob/main/css/style.css"
click node_main_js "https://github.com/chandy-bit/mathsim-platform/blob/main/js/main.js"
click node_modulesloader_js "https://github.com/chandy-bit/mathsim-platform/blob/main/js/modulesloader.js"
click node_plotter_js "https://github.com/chandy-bit/mathsim-platform/blob/main/js/plotter.js"
click node_simulation_core "https://github.com/chandy-bit/mathsim-platform/blob/main/js/simulation-core.js"
click node_simulation_types "https://github.com/chandy-bit/mathsim-platform/blob/main/js/simulation-types.js"
click node_game_js "https://github.com/chandy-bit/mathsim-platform/blob/main/js/game.js"
click node_service_worker "https://github.com/chandy-bit/mathsim-platform/blob/main/js/service-worker.js"
click node_manifest_json "https://github.com/chandy-bit/mathsim-platform/blob/main/manifest.json"
click node_offline_page "https://github.com/chandy-bit/mathsim-platform/blob/main/offline.html"

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_index,node_subject_pages,node_experience_pages,node_docs_pages toneBlue
class node_learning_modules,node_plotter_js toneAmber
class node_simulation_core,node_simulation_types,node_game_js toneMint
class node_dashboard_pages,node_insights_modules toneRose
class node_header_php,node_style_css,node_page_styles,node_main_js,node_modulesloader_js,node_platform_features,node_service_worker,node_manifest_json,node_offline_page toneIndigo
```

## Components

### Presentation pages

Static multi-page front end for learning, docs, and policies

- [Home](https://github.com/chandy-bit/mathsim-platform/blob/main/index.html): entry page · Main landing page for the platform · `index.html`
- **Subjects**: content pages · Core math learning pages for different domains
- **Interactive**: experience pages · Pages for games, simulations, planners, and prototypes
- **Docs & policy**: support pages · Documentation, help, feedback, and legal pages

### Learning engine

Subject content and practice UI

- **Learning modules**: subject logic · Math-specific logic, questions, tutorials, and solution UI
- [Plotter](https://github.com/chandy-bit/mathsim-platform/blob/main/js/plotter.js): visualization · Graphing and visual feedback utilities · `js/plotter.js`

### Simulation runtime

Reusable interactive simulation and game execution

- [Sim core](https://github.com/chandy-bit/mathsim-platform/blob/main/js/simulation-core.js): runtime core · Shared execution engine for simulations and games · `js/simulation-core.js`
- [Sim types](https://github.com/chandy-bit/mathsim-platform/blob/main/js/simulation-types.js): scenario models · Definitions for simulation variants and behaviors · `js/simulation-types.js`
- [Game logic](https://github.com/chandy-bit/mathsim-platform/blob/main/js/game.js): interactive runtime · Game-specific orchestration built on the simulation stack · `js/game.js`

### Insights

Progress, analytics, and leaderboard surfaces

- **Dashboards**: status pages · Pages that surface progress, analytics, and rankings
- **Tracking**: analytics modules · Progress, analytics, dashboard, and leaderboard logic

### Platform services

Shared chrome, theme, PWA, and cross-cutting client features

- [Header](https://github.com/chandy-bit/mathsim-platform/blob/main/header.php): shared template · Optional server-side reusable page chrome · `header.php`
- [Base styles](https://github.com/chandy-bit/mathsim-platform/blob/main/css/style.css): stylesheet · Global visual theme and layout rules · `css/style.css`
- **Page styles**: feature stylesheets · Feature-specific styling for consent and upgrade flows
- [App init](https://github.com/chandy-bit/mathsim-platform/blob/main/js/main.js): bootstrap script · Shared initialization and page startup coordination · `js/main.js`
- [Module loader](https://github.com/chandy-bit/mathsim-platform/blob/main/js/modulesloader.js): loader · Loads page-specific scripts and shared modules · `js/modulesloader.js`
- **Platform features**: cross-cutting modules · Theme, language, accessibility, upgrade, animation, and PWA features
- [Service worker](https://github.com/chandy-bit/mathsim-platform/blob/main/js/service-worker.js): offline runtime · Offline caching and web app runtime support · `js/service-worker.js`
- [Manifest](https://github.com/chandy-bit/mathsim-platform/blob/main/manifest.json): web app metadata · Installable app metadata and startup configuration · `manifest.json`
- [Offline](https://github.com/chandy-bit/mathsim-platform/blob/main/offline.html): fallback page · Fallback experience when the network is unavailable · `offline.html`

## Connections

- Home → Base styles: uses
- Home → App init: boots
- Subjects → Base styles: uses
- Subjects → App init: boots
- Interactive → Base styles: uses
- Interactive → App init: boots
- Dashboards → Base styles: uses
- Dashboards → App init: boots
- Docs & policy → Base styles: uses
- Docs & policy → App init: boots
- Header → Home: shared chrome
- Header → Subjects: shared chrome
- Header → Interactive: shared chrome
- Header → Dashboards: shared chrome
- Header → Docs & policy: shared chrome
- App init → Module loader: delegates
- Module loader → Learning modules: loads
- Module loader → Sim core: loads
- Module loader → Game logic: loads
- Module loader → Tracking: loads
- Module loader → Platform features: loads
- Learning modules → Plotter: visualizes
- Learning modules → Subjects: powers
- Sim core → Sim types: configures
- Sim core → Interactive: powers
- Game logic → Sim core: extends
- Tracking → Dashboards: powers
- Platform features → Base styles: coordinates
- Service worker → Offline: falls back to
- Service worker → Manifest: supports
- Platform features → Service worker: registers
- Platform features → Manifest: supports
