# sakamochanq/liberal-chart architecture

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

- Interactive diagram: https://gitdiagram.com/sakamochanq/liberal-chart
- Repository: https://github.com/sakamochanq/liberal-chart

## Overview

##### Project Type and Purpose
- This is a single‐page React application (“Liberal Chart”) bootstrapped with Create React App.
- It serves as an interactive guide to liberal arts courses at Kanazawa Institute of Technology, consuming a JSON data file and rendering it in the browser.

##### High-Level Architecture Components
a. User’s Browser (Client)
b. Static File Hosting / Web Server (e.g., GitHub Pages, S3 + CloudFront)
c. React Application Bundles (HTML, JS, CSS)
d. Static Assets (images, table.json)
e. Optional PWA Layer (manifest.json, service worker)

##### Relationships & Data Flows
1. Browser issues HTTP GET for `index.html`.
2. Server returns `index.html` which bootstraps `bundle.js` and `main.css`.
3. React (in browser) mounts `<App />` via `src/index.js`.
4. React components (e.g., `Lists.js`, `Explain.js`, `Attention.js`) run client‐side rendering.
5. When data is needed, React issues a fetch XHR for `public/assets/table.json`.
6. JSON data is parsed; components render course listings.
7. Static images under `public/assets/images` are loaded on demand.
8. If PWA is enabled, service worker intercepts requests for offline caching.

##### Key Architectural Patterns & Principles
- Single‐page application (SPA) pattern: Client does routing and rendering.
- Component‐based UI (React).
- Asset separation: JSON, images, code, styles.
- Progressive Web App (optional): manifest + service worker.
- Conventional CRA build/deploy pipeline (`npm run build` → `build/` → static host).

##### Technologies / Frameworks
- React, ReactDOM
- Create React App (Webpack, Babel under the hood)
- JavaScript (ES6+), CSS
- Browser Fetch API (for JSON)
- Optional: Service Worker + Web App Manifest

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser and Server
    Browser["Browser"] 
    Server[(Static Host / CDN)]:::server

    Browser -->|"GET index.html"| Server
    Server -->|"Serves index.html, bundle.js, main.css"| Browser

    %% React Application in Browser
    subgraph "React Application (Client-side)" 
        direction TB
        HTML["index.html"]:::bundle
        CSS["main.css"]:::bundle
        JSBundle["bundle.js"]:::bundle

        HTML -->|"includes"| CSS
        HTML -->|"includes"| JSBundle
        JSBundle -->|"executes bootstrap"| IndexJS["src/index.js"]:::frontend
        IndexJS -->|"renders root"| AppJS["src/App.js"]:::frontend

        AppJS -->|"uses"| Header["Header"]:::frontend
        AppJS -->|"uses"| Footer["Footer"]:::frontend
        AppJS -->|"uses"| Lists["Lists.js"]:::frontend
        AppJS -->|"uses"| Explain["Explain.js"]:::frontend
        AppJS -->|"uses"| Attention["Attention.js"]:::frontend

        Lists -->|"fetches"| TableJSON["table.json"]:::asset
        Lists -->|"loads images"| Images["images/*"]:::asset
    end

    %% Optional PWA Layer
    subgraph "Optional PWA Layer" 
        style OptionalPWALayer stroke-dasharray: 5 5
        Manifest["manifest.json"]:::asset
        ServiceWorker["service-worker.js"]:::asset
        Browser -->|"registers"| ServiceWorker
        Browser -->|"reads"| Manifest
        ServiceWorker -->|"intercepts requests"| Browser
    end

    %% Build Pipeline and Deployment
    subgraph "Build & Deploy Pipeline"
        direction TB
        Src["src/"]:::frontend
        Bundler["CRA Bundler"]:::server
        BuildDir["build/"]:::server

        Src -->|"npm run build"| Bundler
        Bundler -->|"outputs"| BuildDir
        BuildDir -->|"deployed to"| Server
    end

    %% Click Events
    click HTML "https://github.com/sakamochanq/liberal-chart/blob/master/public/index.html"
    click IndexJS "https://github.com/sakamochanq/liberal-chart/blob/master/src/index.js"
    click CSS "https://github.com/sakamochanq/liberal-chart/blob/master/src/index.css"
    click AppJS "https://github.com/sakamochanq/liberal-chart/blob/master/src/App.js"
    click Header "https://github.com/sakamochanq/liberal-chart/blob/master/src/components/Header.js"
    click Footer "https://github.com/sakamochanq/liberal-chart/blob/master/src/components/Footer.js"
    click Lists "https://github.com/sakamochanq/liberal-chart/blob/master/src/components/Lists.js"
    click Explain "https://github.com/sakamochanq/liberal-chart/blob/master/src/components/Explain.js"
    click Attention "https://github.com/sakamochanq/liberal-chart/blob/master/src/components/Attention.js"
    click TableJSON "https://github.com/sakamochanq/liberal-chart/blob/master/public/assets/table.json"
    click Images "https://github.com/sakamochanq/liberal-chart/tree/master/public/assets/images/"
    click Manifest "https://github.com/sakamochanq/liberal-chart/blob/master/public/manifest.json"
    click ServiceWorker "https://github.com/sakamochanq/liberal-chart/blob/master/public/robots.txt"
    click Src "https://github.com/sakamochanq/liberal-chart/tree/master/src/"
    click Bundler "https://github.com/sakamochanq/liberal-chart/blob/master/package.json"
    click Bundler "https://github.com/sakamochanq/liberal-chart/blob/master/package-lock.json"
    click BuildDir "https://github.com/sakamochanq/liberal-chart/blob/master/README.md"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef asset fill:#90EE90,stroke:#000,stroke-width:1px
    classDef server fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef bundle fill:#ADD8E6,stroke:#000,stroke-width:1px
```
