# booterman98/malla-interactiva architecture

> Architecture diagram of the GitHub repository booterman98/malla-interactiva, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/booterman98/malla-interactiva
- Repository: https://github.com/booterman98/malla-interactiva

## Overview

##### Project type and purpose
- This is a client-side, static web application (a Progressive Web App) for visualizing and interacting with university course curricula (“mallas”).
- It serves JSON-driven data, renders interactive UIs in the browser, and persists user state locally.
- The app can be served via any static HTTP server (Python, Docker, GitHub Pages) and registers a service worker for offline support.

##### File structure overview
- Top-level:
- index.html, Dockerfile, serviceWorker.js, site.webmanifest
- css/: global and dark-mode styles
- js/: core modules (init.js, generator.js, malla.js, mallaEditor.js, priorix.js, ramo.js, selectableRamo.js, semesterManager.js, customMalla.js)
- data/: curricula JSON (data_CARR.json + colors_CARR.json) + welcome texts
- views/: HTML fragments (header.html, footer.html)
- personalizar/, prioridad/, contact/: feature-specific HTML entry points
- docs/, assets/: documentation and static assets
- scripts/: dev/build helper scripts
- .github/workflows/: CI/CD Docker build pipeline
- No server-side code: pure front end + static assets + CI for Docker image building.

##### Key architectural insights from README
- UI flows:
- Interactive map of courses by semester
- Prerequisite unlocking logic (js modules)
- Priority calculation widget
- Custom curricula editor
- Build & deployment: npm dev build, Python/Browser-sync or Docker image.

##### Main components
a. Client (Browser)
- HTML entry point(s) (index.html, personalizar/malla.html, prioridad/index.html, contact/index.html)
- CSS & Assets loader
- JavaScript modules (initialization, UI controllers, data fetchers, state managers)
- Service Worker (caching static files + offline support)
- Local storage (IndexedDB or localStorage) for persisting user modifications
b. Static HTTP Server
- Hosts HTML, CSS, JS, JSON, assets
- Can be any HTTP server (Python SimpleHTTPServer, Node/browser-sync, Docker Nginx)
c. Data Store (JSON files)
- Course definitions (data_CARR.json)
- welcomeTexts.json for dynamic greetings
d. CI/CD Pipeline & Containerization
- GitHub Actions workflow builds Docker image
- Dockerfile packages static site into a container (booterman/malla-interactiva)
- Deployment target (any container host, GitHub Pages, labcomp.cl)

##### Relationships & interactions
- Browser → HTTP Server: GET *.html, *.css, *.js, *.json
- JS modules parse JSON → render UI → update DOM
- UI actions → JS controllers → update in-memory state → persist to local storage
- Service Worker intercepts requests → serves from cache or network → caches new assets
- CI pipeline → builds Docker image → pushes/publishes container → end users pull & run container

##### Architectural patterns & design principles
- Modular JS: separation of concerns (init, data layer, UI layer, business logic)
- Client-side MVC/MVVM: models (JSON data + local state), views (HTML + templates), controllers (JS modules)
- Progressive Enhancement: offline support via service worker + caching
- Static site hosting: simplicity, no backend required
- Containerization for consistent deployment

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client (Browser)"
        direction TB
        index["index.html"]:::client
        personalizar_index["personalizar/index.html"]:::client
        personalizar_malla["personalizar/malla.html"]:::client
        prioridad_index["prioridad/index.html"]:::client
        contact_index["contact/index.html"]:::client

        css_styles["css/styles.css"]:::client
        css_darkmode["css/darkMode.css"]:::client
        css_prettify["css/prettify.css"]:::client
        assets["assets/"]:::client

        subgraph "JS Modules"
            direction TB
            init["js/init.js"]:::client
            generator["js/generator.js"]:::client
            malla["js/malla.js"]:::client
            mallaEditor["js/mallaEditor.js"]:::client
            priorix["js/priorix.js"]:::client
            ramo["js/ramo.js"]:::client
            selectableRamo["js/selectableRamo.js"]:::client
            semesterManager["js/semesterManager.js"]:::client
            customMalla["js/customMalla.js"]:::client
        end

        serviceWorker["serviceWorker.js"]:::client
        manifest["site.webmanifest"]:::client
        localStorage["Local Storage"]:::client
    end

    %% Server & Data Layers
    staticServer["Static HTTP Server"]:::server
    subgraph "Data Store"
        direction TB
        data_struct["data/data_*.json"]:::data
        data_colors["data/colors_*.json"]:::data
        data_carreras["data/carreras.json"]:::data
        data_welcome["data/welcomeTexts.json"]:::data
    end

    %% CI/CD & Deployment
    ci["GitHub Actions Workflow"]:::ci
    docker["Docker Container"]:::docker
    deployment["Deployment Host"]:::server

    %% Interactions
    index -->|fetch HTML/CSS/JS/JSON| staticServer
    personalizar_index -->|fetch HTML/CSS/JS/JSON| staticServer
    personalizar_malla -->|fetch HTML/CSS/JS/JSON| staticServer
    prioridad_index -->|fetch HTML/CSS/JS/JSON| staticServer
    contact_index -->|fetch HTML/CSS/JS/JSON| staticServer

    css_styles --> staticServer
    css_darkmode --> staticServer
    css_prettify --> staticServer
    assets --> staticServer

    serviceWorker -->|intercept requests| staticServer
    serviceWorker -->|serve from cache| staticServer
    serviceWorker -->|cache new assets| staticServer

    init --> data_struct
    init --> data_colors
    init --> data_carreras
    init --> data_welcome

    init --> malla
    init --> mallaEditor
    init --> priorix
    init --> ramo
    init --> selectableRamo
    init --> semesterManager
    init --> customMalla

    malla --> localStorage
    mallaEditor --> localStorage
    priorix --> localStorage
    customMalla --> localStorage

    staticServer --> data_struct
    staticServer --> data_colors
    staticServer --> data_carreras
    staticServer --> data_welcome

    ci -->|build image| docker
    docker -->|deploy static site| deployment
    deployment --> staticServer

    %% Click Events
    click index "https://github.com/booterman98/malla-interactiva/blob/master/index.html"
    click personalizar_index "https://github.com/booterman98/malla-interactiva/blob/master/personalizar/index.html"
    click personalizar_malla "https://github.com/booterman98/malla-interactiva/blob/master/personalizar/malla.html"
    click prioridad_index "https://github.com/booterman98/malla-interactiva/blob/master/prioridad/index.html"
    click contact_index "https://github.com/booterman98/malla-interactiva/blob/master/contact/index.html"
    click css_styles "https://github.com/booterman98/malla-interactiva/blob/master/css/styles.css"
    click css_darkmode "https://github.com/booterman98/malla-interactiva/blob/master/css/darkMode.css"
    click css_prettify "https://github.com/booterman98/malla-interactiva/blob/master/css/prettify.css"
    click assets "https://github.com/booterman98/malla-interactiva/tree/master/assets/"
    click init "https://github.com/booterman98/malla-interactiva/blob/master/js/init.js"
    click generator "https://github.com/booterman98/malla-interactiva/blob/master/js/generator.js"
    click malla "https://github.com/booterman98/malla-interactiva/blob/master/js/malla.js"
    click mallaEditor "https://github.com/booterman98/malla-interactiva/blob/master/js/mallaEditor.js"
    click priorix "https://github.com/booterman98/malla-interactiva/blob/master/js/priorix.js"
    click ramo "https://github.com/booterman98/malla-interactiva/blob/master/js/ramo.js"
    click selectableRamo "https://github.com/booterman98/malla-interactiva/blob/master/js/selectableRamo.js"
    click semesterManager "https://github.com/booterman98/malla-interactiva/blob/master/js/semesterManager.js"
    click customMalla "https://github.com/booterman98/malla-interactiva/blob/master/js/customMalla.js"
    click serviceWorker "https://github.com/booterman98/malla-interactiva/blob/master/serviceWorker.js"
    click manifest "https://github.com/booterman98/malla-interactiva/blob/master/site.webmanifest"
    click data_struct "https://github.com/booterman98/malla-interactiva/blob/master/data/data_*.json"
    click data_colors "https://github.com/booterman98/malla-interactiva/blob/master/data/colors_*.json"
    click data_carreras "https://github.com/booterman98/malla-interactiva/blob/master/data/carreras.json"
    click data_welcome "https://github.com/booterman98/malla-interactiva/blob/master/data/welcomeTexts.json"
    click ci "https://github.com/booterman98/malla-interactiva/blob/master/.github/workflows/build-and-deploy.yml"
    click docker "https://github.com/booterman98/malla-interactiva/tree/master/Dockerfile"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000;
    classDef server fill:#90EE90,stroke:#000;
    classDef data fill:#D3D3D3,stroke:#000,stroke-dasharray: 5 5;
    classDef docker fill:#F4A460,stroke:#000;
    classDef ci fill:#FFD700,stroke:#000;
```
