# jsebrech/plainvanilla architecture

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

- Interactive diagram: https://gitdiagram.com/jsebrech/plainvanilla
- Repository: https://github.com/jsebrech/plainvanilla

## Overview

##### Project Type and Purpose
- This is a static, full-frontend website (“Plain Vanilla”) showcasing web development without build tools or frameworks.
- All content lives under the `public/` folder, served by a simple HTTP server. There is no dynamic backend—just HTML, CSS, and JavaScript modules.

##### Key Architectural Components
a. Static File Server
- Serves the `public/` folder via HTTP (e.g., `http-server`, `python -m http.server`).
- Exposes endpoints for HTML pages, assets, blog posts, example apps, and tests.
b. Browser (Client)
- Fetches HTML, CSS, JS modules.
- Executes all logic client-side: routing, blog generation, examples, and tests.
c. Content & Assets
- HTML pages (`public/index.html`, `public/blog/*.html`, `public/pages/**/*.html`, `public/tests/index.html`).
- Styles (`public/styles/*.css`, component CSS under `public/components/**`).
- JavaScript modules:
– Core components in `public/components/` (analytics, code-viewer, tab-panel)
– Example apps under `public/pages/examples/**`
– Blog generator script (`public/blog/generator.js`) + generated posts
– Test runner and specs under `public/tests/`
d. External Resources
- No external APIs; all assets are local.

##### Relationships and Data Flows
- Browser → HTTP Server: GET requests for HTML, CSS, JS, XML (feed), JSON (index.json), and other static assets.
- On page load: HTML includes `<script type="module">` imports, CSS links.
- JavaScript modules import each other (e.g., examples import tiny-context or view-route).
- Blog generator script runs client-side or pre-run to produce static blog post pages.
- Tests are executed in the browser via Mocha/Chai loaded under `public/tests/`.

##### Architectural Patterns & Principles
- Monolithic static site architecture: no microservices, no backend layer.
- Modular JavaScript (ES modules) for code reuse and componentization.
- Separation of concerns:
- Content (HTML)
- Presentation (CSS, scoped by component)
- Behavior (vanilla JS modules)
- Progressive enhancement: pages work without bundlers or transpilers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infra Layer
    Browser["Browser Client"]:::client
    Server["HTTP Server"]:::infra

    Browser -->|GET HTML, CSS, JS, Data| Server

    %% Public directory
    subgraph "public/"
        direction TB

        %% HTML Content
        subgraph "HTML Pages" 
            direction TB
            IndexHTML["index.html"]:::content
            PagesHTML["pages/*.html"]:::content
            ExamplesHTML["pages/examples/**/index.html"]:::content
            BlogIndex["blog/index.html"]:::content
            BlogPosts["blog/articles/**/index.html"]:::content
            BlogArchive["blog/archive.html"]:::content
            TestsHTML["tests/index.html"]:::content
        end

        %% CSS Styles
        subgraph "CSS Styles"
            direction TB
            GlobalCSS["styles/global.css"]:::presentation
            ResetCSS["styles/reset.css"]:::presentation
            VarsCSS["styles/variables.css"]:::presentation
            CVCSS["components/code-viewer/code-viewer.css"]:::presentation
            TPCSS["components/tab-panel/tab-panel.css"]:::presentation
        end

        %% JS Modules
        subgraph "JavaScript Modules"
            direction TB
            subgraph "Core Components"
                AnalyticsJS["components/analytics/analytics.js"]:::behavior
                CVJS["components/code-viewer/code-viewer.js"]:::behavior
                TPJS["components/tab-panel/tab-panel.js"]:::behavior
            end
            subgraph "Utility Libraries"
                HTMLLib["lib/html.js"]:::behavior
                SyntaxHL["lib/speed-highlight/index.js"]:::behavior
            end
            subgraph "Example Apps"
                ExamplesJS["pages/examples/**/**/*.js"]:::behavior
            end
            subgraph "Blog Generator"
                GenHTML["blog/generator.html"]:::content
                GenJS["blog/generator.js"]:::behavior
                ArticleGen["blog/articles/**/generator.js"]:::behavior
            end
            subgraph "Test Suite"
                TestsJS["tests/index.js"]:::behavior
                TPTest["tests/tabpanel.test.js"]:::behavior
                ImpTest["tests/imports-test.js"]:::behavior
            end
        end

        %% Static Data
        subgraph "Static Data"
            direction TB
            FeedXML["blog/feed.xml"]:::content
            IndexJSON["blog/index.json"]:::content
            Manifest["manifest.json"]:::content
            Robots["robots.txt"]:::content
            Sitemap["sitemap.txt"]:::content
        end
    end

    %% Content dependencies
    IndexHTML -->|"links"| GlobalCSS
    IndexHTML -->|"links"| ResetCSS
    IndexHTML -->|"links"| VarsCSS
    IndexHTML -->|"import modules"| CVJS
    PagesHTML -->|"links"| GlobalCSS
    ExamplesHTML -->|"links"| CVCSS
    TestsHTML -->|"import Mocha/Chai"| TestsJS

    %% JS imports
    CVJS -->|"imports"| HTMLLib
    CVJS -->|"uses syntax"| SyntaxHL
    TPJS -->|"imports"| HTMLLib
    ExamplesJS -->|"imports utils"| HTMLLib
    ExamplesJS -->|"imports components"| CVJS

    GenJS -->|"generates posts"| BlogPosts
    ArticleGen -->|"runs per post"| BlogPosts

    TestsJS -->|"imports specs"| TPTest
    TestsJS -->|"imports specs"| ImpTest

    %% Serving relationships
    Server -->|"serves"| IndexHTML
    Server -->|"serves"| PagesHTML
    Server -->|"serves"| ExamplesHTML
    Server -->|"serves"| BlogIndex
    Server -->|"serves"| BlogArchive
    Server -->|"serves"| TestsHTML
    Server -->|"serves"| GlobalCSS
    Server -->|"serves"| ResetCSS
    Server -->|"serves"| VarsCSS
    Server -->|"serves"| CVCSS
    Server -->|"serves"| TPCSS
    Server -->|"serves"| AnalyticsJS
    Server -->|"serves"| CVJS
    Server -->|"serves"| TPJS
    Server -->|"serves"| HTMLLib
    Server -->|"serves"| SyntaxHL
    Server -->|"serves"| ExamplesJS
    Server -->|"serves"| GenHTML
    Server -->|"serves"| GenJS
    Server -->|"serves"| ArticleGen
    Server -->|"serves"| TestsJS
    Server -->|"serves"| TPTest
    Server -->|"serves"| ImpTest
    Server -->|"serves"| FeedXML
    Server -->|"serves"| IndexJSON
    Server -->|"serves"| Manifest
    Server -->|"serves"| Robots
    Server -->|"serves"| Sitemap

    %% Click Events
    click IndexHTML "https://github.com/jsebrech/plainvanilla/blob/main/public/index.html"
    click PagesHTML "https://github.com/jsebrech/plainvanilla/tree/main/public/pages/"
    click ExamplesHTML "https://github.com/jsebrech/plainvanilla/tree/main/public/pages/examples/"
    click BlogIndex "https://github.com/jsebrech/plainvanilla/blob/main/public/blog/index.html"
    click BlogPosts "https://github.com/jsebrech/plainvanilla/tree/main/public/blog/articles/"
    click BlogArchive "https://github.com/jsebrech/plainvanilla/blob/main/public/blog/archive.html"
    click TestsHTML "https://github.com/jsebrech/plainvanilla/blob/main/public/tests/index.html"
    click GlobalCSS "https://github.com/jsebrech/plainvanilla/blob/main/public/styles/global.css"
    click ResetCSS "https://github.com/jsebrech/plainvanilla/blob/main/public/styles/reset.css"
    click VarsCSS "https://github.com/jsebrech/plainvanilla/blob/main/public/styles/variables.css"
    click CVCSS "https://github.com/jsebrech/plainvanilla/blob/main/public/components/code-viewer/code-viewer.css"
    click TPCSS "https://github.com/jsebrech/plainvanilla/blob/main/public/components/tab-panel/tab-panel.css"
    click AnalyticsJS "https://github.com/jsebrech/plainvanilla/blob/main/public/components/analytics/analytics.js"
    click CVJS "https://github.com/jsebrech/plainvanilla/blob/main/public/components/code-viewer/code-viewer.js"
    click TPJS "https://github.com/jsebrech/plainvanilla/blob/main/public/components/tab-panel/tab-panel.js"
    click HTMLLib "https://github.com/jsebrech/plainvanilla/blob/main/public/lib/html.js"
    click SyntaxHL "https://github.com/jsebrech/plainvanilla/blob/main/public/lib/speed-highlight/index.js"
    click ExamplesJS "https://github.com/jsebrech/plainvanilla/tree/main/public/pages/examples/"
    click GenHTML "https://github.com/jsebrech/plainvanilla/blob/main/public/blog/generator.html"
    click GenJS "https://github.com/jsebrech/plainvanilla/blob/main/public/blog/generator.js"
    click ArticleGen "https://github.com/jsebrech/plainvanilla/tree/main/public/blog/articles/"
    click TestsJS "https://github.com/jsebrech/plainvanilla/blob/main/public/tests/index.js"
    click TPTest "https://github.com/jsebrech/plainvanilla/blob/main/public/tests/tabpanel.test.js"
    click ImpTest "https://github.com/jsebrech/plainvanilla/blob/main/public/tests/imports-test.js"
    click FeedXML "https://github.com/jsebrech/plainvanilla/blob/main/public/blog/feed.xml"
    click IndexJSON "https://github.com/jsebrech/plainvanilla/blob/main/public/blog/index.json"
    click Manifest "https://github.com/jsebrech/plainvanilla/blob/main/public/manifest.json"
    click Robots "https://github.com/jsebrech/plainvanilla/blob/main/public/robots.txt"
    click Sitemap "https://github.com/jsebrech/plainvanilla/blob/main/public/sitemap.txt"

    %% Styles
    classDef client fill:#f0b278,stroke:#333,stroke-width:1px
    classDef infra fill:#f2f3f4,stroke:#333,stroke-width:1px
    classDef content fill:#d5f5e3,stroke:#333,stroke-width:1px
    classDef presentation fill:#d6eaf8,stroke:#333,stroke-width:1px
    classDef behavior fill:#f9e79f,stroke:#333,stroke-width:1px
```
