# bonillajose2022-eng/thereisthereare.index.html architecture

> Architecture diagram of the GitHub repository bonillajose2022-eng/thereisthereare.index.html, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bonillajose2022-eng/thereisthereare.index.html
- Repository: https://github.com/bonillajose2022-eng/thereisthereare.index.html

## Overview

This is a **static, client-only educational web app** (no backend) built with **vanilla HTML/CSS/JS**. The “system” is essentially the **browser runtime** executing `app.js` against the DOM in `index.html`, styled by `styles.css`, using **localStorage** for persistence, and loading **SVG assets** (plus Google Fonts).

##### File-structure-driven architecture (map files to components)
From the tree:

- `index.html`
**UI composition + content** (all sections: explanations, exercises, quiz, teacher mode entry point). This is the “View + content source of truth” in a static site.

- `styles.css`
**Presentation layer** (responsive layout, animations, themes). No runtime logic, but important for “UI layer” separation.

- `app.js`
**Application/controller logic**:
- exercise interactivity (8 exercise types)
- scoring + progress bar
- final quiz rules (15 questions, one attempt per device)
- teacher mode (password gate, reveal answers, reset quiz)
- localStorage read/write (progress + attempts)

- `assets/*`
**Static media** (SVG illustrations referenced by HTML/CSS/JS).

- `README.md`
Docs + run/deploy notes (GitHub Pages / static hosting).

This is basically an **SPA-like** experience without a framework: one HTML page, JS controlling sections, state, and UI updates.

##### Delivery / Hosting (optional but useful)
- **Static Host** (GitHub Pages / any static server)
- serves: `index.html`, `styles.css`, `app.js`, `assets/*.svg`

##### Client Runtime (the core)
Inside the **Browser** boundary, split into:

##### UI / DOM Layer
- Navigation bar (includes “Teacher” button)
- Grammar content sections
- Exercise sections (8 types)
- Final quiz section
- Progress bar / score display
- Answer reveal areas (affected by Teacher Mode)

##### App Logic Layer (`app.js`) — break into subcomponents
- **Router/Section Controller** (even if implicit): shows/hides sections, manages navigation state
- **Exercise Engine**
- generators/checkers per exercise type (fill blank, MCQ, matching, etc.)
- validation + feedback rendering
- **Scoring & Progress Manager**
- updates progress bar
- aggregates scores across exercises
- **Final Quiz Manager**
- enforces “one attempt per device”
- grades 15 questions
- locks/unlocks based on stored attempt state
- **Teacher Mode Manager**
- password verification (`TEACHER123`)
- toggles “show answers” UI states
- resets final quiz attempt state
- **Persistence Adapter**
- localStorage read/write for:
- progress / scores
- final quiz attempt flag
- possibly per-exercise completion

##### External Resources
- **Google Fonts** (network dependency)
- (Optionally) “Inline/External SVG assets” as a static resource dependency

##### Architectural patterns to highlight (accurate to this repo)
- **Client-only / JAMstack-style static site** (no API, no DB server)
- **Event-driven DOM programming** (vanilla JS)
- **Stateful UI via localStorage** (persistence per device)
- **Feature modules inside one JS file** (conceptually modular even if physically monolithic)

##### Labels
Use labels that match the repo + domain:
- “Exercise Engine (8 types)”
- “Final Quiz Manager (15 Q, single attempt/device)”
- “Teacher Mode (password gated, show answers, reset quiz)”
- “Persistence (localStorage: progress, score, quizAttempt)”

Use this as your component inventory:

- Static Host (GitHub Pages / local server)
- serves: index.html, styles.css, app.js, assets/*.svg
- Browser (Client)
- UI Sections (index.html)
- Grammar lessons
- Exercises (8 types)
- Final Quiz
- Teacher Button / Teacher UI
- Progress Bar / Score UI
- Styling (styles.css)
- App Logic (app.js)
- Section Controller
- Exercise Engine
- Scoring & Progress Manager
- Final Quiz Manager
- Teacher Mode Manager
- localStorage Adapter
- localStorage (progress, scores, quizAttempt flag)
- External
- Google Fonts CDN

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Diagram 1 — System Context (C4 L1)
  %% =========================
  subgraph "System Context (Static client-only web app)"
    direction TB

    UStudent["User: Student"]:::external
    UTeacher["User: Teacher"]:::external

    Host["Static Host (GitHub Pages / Static Server)"]:::host

    subgraph "Browser App (This Project)"
      direction TB
      Browser["Browser Runtime (HTML/CSS/JS)"]:::browser
    end

    Fonts["Google Fonts CDN"]:::external
    AssetsExt["SVG Assets (served as static files)"]:::static
  end

  UStudent -->|"HTTPS:load_site"| Host
  UTeacher -->|"HTTPS:load_site"| Host
  Host -->|"serves:index.html/styles.css/app.js/assets"| Browser

  Browser -.->|"fetch_fonts"| Fonts
  Browser -.->|"fetch_svg"| AssetsExt

  %% =========================
  %% Diagram 2 — Container/Component (C4 L2/3 blended)
  %% =========================
  subgraph "Browser (Client Runtime)"
    direction TB

    subgraph "UI / Presentation Layer"
      direction TB
      Index["UI Composition + Content (index.html)\n- Grammar lessons\n- Exercises (8 types)\n- Final quiz\n- Teacher entry point\n- Progress/score UI\n- Answer reveal areas"]:::ui

      Styles["Styling / Presentation (styles.css)\n- Responsive layout\n- Animations\n- Themes"]:::css
    end

    subgraph "App Logic Layer (app.js)"
      direction TB

      App["Application / Controller Logic (app.js)"]:::logic

      SectionCtl["Router / Section Controller\n(show/hide sections, nav state)"]:::logic
      Exercise["Exercise Engine (8 types)\n(generate/check/validate)\n(render feedback)"]:::logic
      ScoreProg["Scoring & Progress Manager\n(update progress bar, aggregate scores)"]:::logic
      Quiz["Final Quiz Manager\n(15 questions)\n(single attempt/device)\n(grading + locking)"]:::logic
      Teacher["Teacher Mode Manager\n(password: TEACHER123)\n(show answers)\n(reset quiz)"]:::logic
      Persist["Persistence Adapter\n(localStorage R/W)\n(progress, scores, quizAttempt)"]:::persist
    end

    LS[("Web Storage\nlocalStorage")]:::storage
  end

  subgraph "Static Resources (served by host)"
    direction TB
    Svg["Static Media / SVG Assets"]:::static
    Readme["Documentation (README.md)"]:::docs
  end

  %% Runtime: event-driven flow
  UStudent -->|"click/type/drag"| Index
  UTeacher -->|"click/type"| Index

  Index -->|"DOM_events"| App
  App -->|"updates_DOM(UI_state,feedback)"| Index
  Styles -->|"CSS_rules"| Index

  %% Internal app module interactions
  App -->|"controls_sections"| SectionCtl
  App -->|"handles_exercises"| Exercise
  App -->|"updates_score_progress"| ScoreProg
  App -->|"runs_final_quiz"| Quiz
  App -->|"teacher_actions"| Teacher
  App -->|"persist_state"| Persist

  %% Persistence read/write
  Persist <-->|"read_write"| LS

  %% Teacher mode + quiz rules
  Teacher -->|"toggle_answers_visible"| Index
  Teacher -->|"reset_quizAttempt"| Persist
  Quiz -->|"check_attempt_on_load/start"| Persist
  Quiz -->|"lock_or_unlock_UI"| Index
  Quiz -->|"write_attempt_flag_on_submit"| Persist
  ScoreProg -->|"render_progress_bar"| Index
  Exercise -->|"render_feedback"| Index

  %% Assets / fonts fetch (read-only dependencies)
  Index -.->|"references_svg"| Svg
  Styles -.->|"references_fonts"| Fonts
  Index -.->|"references_fonts"| Fonts

  %% Hosting delivers files
  Host -.->|"serves_assets"| Svg
  Host -.->|"serves_docs"| Readme

  %% =========================
  %% Click events (from component_mapping)
  %% =========================
  click Index "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/index.html"
  click Styles "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/styles.css"
  click App "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/app.js"
  click SectionCtl "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/app.js"
  click Exercise "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/app.js"
  click ScoreProg "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/app.js"
  click Quiz "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/app.js"
  click Teacher "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/app.js"
  click Persist "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/app.js"
  click Svg "https://github.com/bonillajose2022-eng/thereisthereare.index.html/tree/main/assets/"
  click Readme "https://github.com/bonillajose2022-eng/thereisthereare.index.html/blob/main/README.md"

  %% =========================
  %% Styles
  %% =========================
  classDef external fill:#EEF2FF,stroke:#3730A3,stroke-width:1.5px,color:#111827;
  classDef host fill:#ECFEFF,stroke:#155E75,stroke-width:1.5px,color:#0F172A;
  classDef browser fill:#F1F5F9,stroke:#334155,stroke-width:1.5px,color:#0F172A;
  classDef ui fill:#DBEAFE,stroke:#1D4ED8,stroke-width:1.5px,color:#0F172A;
  classDef css fill:#BFDBFE,stroke:#2563EB,stroke-width:1.5px,color:#0F172A;
  classDef logic fill:#EDE9FE,stroke:#6D28D9,stroke-width:1.5px,color:#0F172A;
  classDef persist fill:#FFEDD5,stroke:#C2410C,stroke-width:1.5px,color:#0F172A;
  classDef storage fill:#FED7AA,stroke:#9A3412,stroke-width:2px,color:#0F172A;
  classDef static fill:#F3F4F6,stroke:#6B7280,stroke-width:1.5px,color:#111827;
  classDef docs fill:#E5E7EB,stroke:#4B5563,stroke-width:1.5px,color:#111827;
```
