# areso/1255-burgomaster architecture

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

- Interactive diagram: https://gitdiagram.com/areso/1255-burgomaster
- Repository: https://github.com/areso/1255-burgomaster

## Overview

##### Project type and purpose
- This is a static, single‐page web application: an idle city‐building game (“1255 Burgomaster”) written in vanilla JavaScript, HTML5, and CSS.
- No backend code or server‐side logic is present; the entire game runs in the browser, using localStorage for persistence.
- CI/CD and testing infrastructure are included via GitHub Actions workflows, shell scripts, Selenium/Pytest, and Cypress.

##### File structure
- Top level:
- index.html, css/, js/, langs/, resources/, sounds/, tiles/ → all static assets.
- misc/ → design docs, lore, math models.
- ci-scripts/ and continuous_delivery/ → scripts to start a local server, run tests, and push to production.
- tests/ → Selenium/Pytest and Cypress tests organized by type (E2E, smoke, unit, HTML validation, language checks).
- js/:
- config.js, bindings.js, dom.js → core engine and DOM glue.
- game.js → game loop and main entry point.
- mech_*.js and tab_*.js → feature modules for mechanics (auto‐battles, events) and UI tabs.
- objects_*.js → data models for units, artifacts, tech tree.
- js/lib/ → helper libraries (dialogue, bindings, mech_online).
- langs/ → per‐language JSON/JS files loaded at startup.
- continuous_delivery/ and .github/workflows/ → automated CI/CD pipelines for code analysis, tests, and deployment.

##### README for additional insights
- Confirms that it is a browser‐only game needing no server beyond static hosting.
- Emphasizes use of HTML5 Canvas, ES5/ES6, JSON.parse(), localStorage.
- Mentions global events and built‐in chat (though chat may depend on an external service not in this repo).
- No runtime API layer in this repo (all assets live on the same domain).

##### Elements
– Asset download (Server → Browser)
– Module calls (JS Engine → Resource Loader/localStorage)
– Test/deploy triggers (GitHub Actions → Shell scripts → Server)
– Static Hosting (green)
– Browser components (blue)
– Persistence (yellow)
– External Services (orange)
– CI/CD (purple)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Static Hosting
    subgraph "Static Hosting" 
        direction TB
        WebServer["Web Server / CDN"]:::static
    end

    %% Browser Client
    subgraph "Browser Client" 
        direction TB
        HTMLLoader["HTML Loader"]:::browser
        CSSRenderer["CSS Renderer"]:::browser
        subgraph "JS Engine"
            direction TB
            subgraph "Core Modules"
                direction TB
                Config["config.js"]:::core
                GameLoop["game.js"]:::core
                DOMGlue["dom.js"]:::core
                Bindings["bindings.js"]:::core
            end
            subgraph "Feature Modules"
                direction TB
                subgraph "Mechanics"
                    direction TB
                    AdvMap["mech_advmap_gen.js"]:::feature
                    AutoBattle["mech_autobattles.js"]:::feature
                    Events["mech_random_events.js"]:::feature
                    TipsStory["mech_tips_story.js"]:::feature
                end
                subgraph "UI Tabs"
                    direction TB
                    TabBuilding["tab_building.js"]:::feature
                    TabInn["tab_inn.js"]:::feature
                    TabBlackmarket["tab_blackmarket.js"]:::feature
                end
                subgraph "Data Models"
                    direction TB
                    Artifacts["objects_artifacts.js"]:::feature
                    TechTree["objects_technology_tree.js"]:::feature
                    Units["objects_units.js"]:::feature
                end
            end
            subgraph "Libraries"
                direction TB
                LibDir["js/lib/"]:::lib
            end
        end
        subgraph "Localization Service"
            direction TB
            LangsDir["langs/"]:::i18n
            Localisation["localisation.js"]:::i18n
        end
        subgraph "Resource Loader"
            direction TB
            Resources["resources/"]:::resource
            Sounds["sounds/"]:::resource
            Tiles["tiles/"]:::resource
        end
        Persistence["localStorage"]:::storage
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Analytics["Analytics Endpoint"]:::external
        ChatService["Chat / Events Service"]:::external
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        Workflows[".github/workflows/"]:::cicd
        ShellScripts["ci-scripts/"]:::cicd
        CDscripts["continuous_delivery/"]:::cicd
    end

    %% Connections
    WebServer -->|"serves index.html, CSS, JS"| HTMLLoader
    HTMLLoader --> CSSRenderer
    HTMLLoader --> GameLoop
    CSSRenderer --> GameLoop
    GameLoop --> Config
    GameLoop --> DOMGlue
    GameLoop --> Bindings
    GameLoop --> AdvMap
    GameLoop --> AutoBattle
    GameLoop --> Events
    GameLoop --> TipsStory
    GameLoop --> TabBuilding
    GameLoop --> TabInn
    GameLoop --> TabBlackmarket
    GameLoop --> Artifacts
    GameLoop --> TechTree
    GameLoop --> Units
    GameLoop --> LibDir
    GameLoop --> Resources
    GameLoop --> Sounds
    GameLoop --> Tiles
    GameLoop --> Persistence
    GameLoop --> LangsDir
    LangsDir --> Localisation
    GameLoop --> Analytics
    GameLoop --> ChatService
    Workflows --> ShellScripts
    Workflows --> CDscripts
    ShellScripts --> WebServer
    CDscripts --> WebServer

    %% Click Events
    click HTMLLoader "https://github.com/areso/1255-burgomaster/blob/master/index.html"
    click CSSRenderer "https://github.com/areso/1255-burgomaster/tree/master/css/"
    click Config "https://github.com/areso/1255-burgomaster/blob/master/js/config.js"
    click GameLoop "https://github.com/areso/1255-burgomaster/blob/master/js/game.js"
    click DOMGlue "https://github.com/areso/1255-burgomaster/blob/master/js/dom.js"
    click Bindings "https://github.com/areso/1255-burgomaster/blob/master/js/bindings.js"
    click AdvMap "https://github.com/areso/1255-burgomaster/blob/master/js/mech_advmap_gen.js"
    click AutoBattle "https://github.com/areso/1255-burgomaster/blob/master/js/mech_autobattles.js"
    click Events "https://github.com/areso/1255-burgomaster/blob/master/js/mech_random_events.js"
    click TipsStory "https://github.com/areso/1255-burgomaster/blob/master/js/mech_tips_story.js"
    click TabBuilding "https://github.com/areso/1255-burgomaster/blob/master/js/tab_building.js"
    click TabInn "https://github.com/areso/1255-burgomaster/blob/master/js/tab_inn.js"
    click TabBlackmarket "https://github.com/areso/1255-burgomaster/blob/master/js/tab_blackmarket.js"
    click Artifacts "https://github.com/areso/1255-burgomaster/blob/master/js/objects_artifacts.js"
    click TechTree "https://github.com/areso/1255-burgomaster/blob/master/js/objects_technology_tree.js"
    click Units "https://github.com/areso/1255-burgomaster/blob/master/js/objects_units.js"
    click LibDir "https://github.com/areso/1255-burgomaster/tree/master/js/lib/"
    click LangsDir "https://github.com/areso/1255-burgomaster/tree/master/langs/"
    click Resources "https://github.com/areso/1255-burgomaster/tree/master/resources/"
    click Sounds "https://github.com/areso/1255-burgomaster/tree/master/sounds/"
    click Tiles "https://github.com/areso/1255-burgomaster/tree/master/tiles/"
    click Workflows "https://github.com/areso/1255-burgomaster/tree/master/.github/workflows/"
    click ShellScripts "https://github.com/areso/1255-burgomaster/tree/master/ci-scripts/"
    click CDscripts "https://github.com/areso/1255-burgomaster/tree/master/continuous_delivery/"

    %% Styles
    classDef static fill:#b7e4c7,stroke:#2d6a4f,color:#072227
    classDef browser fill:#caf0f8,stroke:#0077b6,color:#023e8a
    classDef core fill:#ade8f4,stroke:#0096c7,color:#03045e
    classDef feature fill:#90e0ef,stroke:#00b4d8,color:#03045e
    classDef lib fill:#48cae4,stroke:#00b4d8,color:#03045e
    classDef i18n fill:#ffd6a5,stroke:#fb8b24,color:#7f2704
    classDef resource fill:#ffcad4,stroke:#e63946,color:#6a040f
    classDef storage fill:#fff3bf,stroke:#ffba08,color:#663c00
    classDef external fill:#ffadad,stroke:#d00000,color:#630000
    classDef cicd fill:#e0c3fc,stroke:#9d4edd,color:#300032
```
