# reznormichael/hollow-knight-completion-check architecture

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

- Interactive diagram: https://gitdiagram.com/reznormichael/hollow-knight-completion-check
- Repository: https://github.com/reznormichael/hollow-knight-completion-check

## Overview

##### Project Type and Purpose
- This is a purely client-side, single-page web application (an open-source tool) that runs entirely in the browser.
- It reads/unpacks a Hollow Knight save file (user*.dat), decrypts/parses it with AES-JS, and displays completion stats, hints, and game data.
- Build process uses Webpack (dev/stage/prod), Babel, ESLint; output is static HTML/CSS/JS served via GitHub Pages or any static host.

##### Core Architectural Components
A. Development Environment
– Source code under src/ (HTML template, CSS, JS modules, partials, fonts, images)
– Configuration files: webpack.dev.js, webpack.stage.js, webpack.prod.js, .eslintrc.js, .gitignore, package.json
B. Build Pipeline
– Webpack (three modes): dev, stage, prod
– Babel and core-js handle JS transpilation/polyfills
– Output directories:
- build/ (production bundle for local testing)
- stage/ (staging bundle)
- docs/ (GitHub Pages deployment bundle)
C. Client-Side Runtime
– Browser loads index.html + main.css + app.js
– app.js orchestrates:
- File input (LoadSaveFile.js) or paste-in text (LoadJson.js)
- AES decryption (aes-js.js)
- Data model classes (classes.js)
- Parsing/database logic (hk-database.js, hk-dictionary.js)
- UI rendering & page-functions (index.js, page-functions.js)
- Cookie consent & analytics (cookiealert.js, cookies.js, partials/*.html)
– Assets (img/, font/, css/) loaded as static resources
D. External Services (optional)
– Analytics (Google Analytics embed partial)
– Steam Guide link and PayPal donate integration (external redirects only)

##### Relationships and Data Flows
- Developer edits src files → runs Webpack → deploys bundle to docs/ or static host.
- Browser requests index.html → CSS + JS bundle loaded.
- User selects a save file or pastes text → FileReader API + LoadSaveFile/LoadJson modules read input → AES module decrypts hex/blob → Parser modules extract game state → Data model populated → UI modules re-render tabs and stats.
- Cookies & localStorage manage user preferences (hint toggles).
- Page may fire analytics events based on partials.

##### Architectural Patterns & Principles
- Modular JavaScript: each feature implemented as a separate module under src/js.
- Build-time configuration: three Webpack configurations allow different environment settings (dev, stage, prod).
- Static hosting: no server or backend; pure client-side.
- Progressive enhancement: works offline, requires no internet, runs entirely in modern browsers.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Layer
    Dev["Developer & IDE"]:::dev

    %% Source & Configurations
    subgraph "Source & Config" 
        HTML["src/index.html"]:::source
        CSS1["src/css/style.css"]:::source
        CSS2["src/css/cookieconsent.css"]:::source
        CSS3["src/css/fontello.css"]:::source
        CSS4["src/css/reznoricon.css"]:::source
        CSS5["src/css/simpleicon.css"]:::source
        FONT["src/font/"]:::source
        IMG["src/img/"]:::source
        PART1["src/partials/cookiealert.html"]:::source
        PART2["src/partials/analytics.html"]:::source
        PART3["src/partials/analytics-dev.html"]:::source
        CONFIG1["webpack.dev.js"]:::buildtime
        CONFIG2["webpack.stage.js"]:::buildtime
        CONFIG3["webpack.prod.js"]:::buildtime
        ESL1[".eslintrc.js"]:::buildtime
        ESL2[".eslintignore"]:::buildtime
        PKG1["package.json"]:::buildtime
        PKG2["package-lock.json"]:::buildtime
    end

    %% Build Pipeline
    subgraph "Build Pipeline" 
        WP["Webpack"]:::buildtime
        SUBDEV["Dev Mode"]:::buildtime
        SUBSTG["Stage Mode"]:::buildtime
        SUBPROD["Prod Mode"]:::buildtime
    end

    %% Build Outputs
    subgraph "Build Outputs" 
        OUT1["build/"]:::deploy
        OUT2["stage/"]:::deploy
        OUT3["docs/"]:::deploy
    end

    %% Hosting Layer
    Host["Static Hosting\n(GitHub Pages)"]:::deploy

    %% Browser Runtime
    subgraph "Browser Runtime" 
        Browser["Browser"]:::runtime
        subgraph "Input & Decryption"
            LoadFile["LoadSaveFile.js"]:::runtime
            LoadJSON["LoadJson.js"]:::runtime
            AES["aes-js.js"]:::runtime
        end
        subgraph "Data Parsing & Model"
            Classes["classes.js"]:::runtime
            DB1["hk-database.js"]:::runtime
            DB2["hk-database-old.js"]:::runtime
            DICT["hk-dictionary.js"]:::runtime
            FUNC["hk-functions.js"]:::runtime
        end
        subgraph "Completion Logic"
            CHECK1["HKCheckCompletion.js"]:::runtime
            CHECK2["HKCheckCompletion-old.js"]:::runtime
        end
        subgraph "UI & Page Functions"
            IDX["index.js"]:::runtime
            PAGEF["page-functions.js"]:::runtime
        end
        subgraph "Cookie & Analytics"
            CA1["cookiealert.js"]:::runtime
            CA2["cookies.js"]:::runtime
            PARTAL["Cookie & Analytics Partials"]:::runtime
        end
        MEM["In-Memory Model"]:::data
        LS["localStorage"]:::data
    end

    %% External Services
    subgraph "External Services"
        GA["Google Analytics"]:::external
        Steam["Steam Guide Link"]:::external
        PayPal["PayPal Donate"]:::external
    end

    %% Connections
    Dev -->|edits| HTML
    Dev --> CSS1 & CSS2 & CSS3 & CSS4 & CSS5 & FONT & IMG & PART1 & PART2 & PART3 & LoadFile & LoadJSON & AES & Classes & DB1 & DB2 & DICT & FUNC & CHECK1 & CHECK2 & IDX & PAGEF & CA1 & CA2 & CONFIG1 & CONFIG2 & CONFIG3 & ESL1 & ESL2 & PKG1 & PKG2
    HTML & CSS1 & CSS2 & CSS3 & CSS4 & CSS5 & FONT & IMG & PART1 & PART2 & PART3 & LoadFile & LoadJSON & AES & Classes & DB1 & DB2 & DICT & FUNC & CHECK1 & CHECK2 & IDX & PAGEF & CA1 & CA2 & CONFIG1 & CONFIG2 & CONFIG3 & ESL1 & ESL2 & PKG1 & PKG2 -->|input to| WP
    WP --> SUBDEV
    WP --> SUBSTG
    WP --> SUBPROD
    SUBDEV --> OUT1
    SUBSTG --> OUT2
    SUBPROD --> OUT3
    OUT1 & OUT2 & OUT3 --> Host
    Host -->|serves| Browser

    Browser --> LoadFile
    Browser --> LoadJSON
    LoadFile --> AES
    LoadJSON --> AES
    AES --> Classes
    Classes --> DB1 & DB2 & DICT & FUNC
    DB1 & DB2 & DICT & FUNC --> CHECK1 & CHECK2
    CHECK1 & CHECK2 --> IDX & PAGEF
    IDX & PAGEF -->|render| MEM
    MEM --> LS
    IDX & PAGEF --> GA
    IDX & PAGEF --> Steam
    IDX & PAGEF --> PayPal

    %% Click Events
    click HTML "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/index.html"
    click CSS1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/css/style.css"
    click CSS2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/css/cookieconsent.css"
    click CSS3 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/css/fontello.css"
    click CSS4 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/css/reznoricon.css"
    click CSS5 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/css/simpleicon.css"
    click FONT "https://github.com/reznormichael/hollow-knight-completion-check/tree/master/src/font/"
    click IMG "https://github.com/reznormichael/hollow-knight-completion-check/tree/master/src/img/"
    click PART1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/partials/cookiealert.html"
    click PART2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/partials/analytics.html"
    click PART3 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/partials/analytics-dev.html"
    click CONFIG1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/webpack.dev.js"
    click CONFIG2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/webpack.stage.js"
    click CONFIG3 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/webpack.prod.js"
    click ESL1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/.eslintrc.js"
    click ESL2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/.eslintignore"
    click PKG1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/package.json"
    click PKG2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/package-lock.json"
    click LoadFile "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/LoadSaveFile.js"
    click LoadJSON "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/LoadJson.js"
    click AES "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/aes-js.js"
    click Classes "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/classes.js"
    click DB1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/hk-database.js"
    click DB2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/hk-database-old.js"
    click DICT "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/hk-dictionary.js"
    click FUNC "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/hk-functions.js"
    click CHECK1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/HKCheckCompletion.js"
    click CHECK2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/HKCheckCompletion-old.js"
    click IDX "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/index.js"
    click PAGEF "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/page-functions.js"
    click CA1 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/cookiealert.js"
    click CA2 "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/js/cookies.js"
    click OUT1 "https://github.com/reznormichael/hollow-knight-completion-check/tree/master/build/"
    click OUT2 "https://github.com/reznormichael/hollow-knight-completion-check/tree/master/stage/"
    click OUT3 "https://github.com/reznormichael/hollow-knight-completion-check/tree/master/docs/"
    click GA "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/src/partials/analytics.html"
    click Steam "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/README.md"
    click PayPal "https://github.com/reznormichael/hollow-knight-completion-check/blob/master/README.md"

    %% Styling
    classDef dev fill:#D6E9FF,stroke:#1E77E3,color:#1E77E3;
    classDef source fill:#E3F2FD,stroke:#42A5F5,color:#1E40AF;
    classDef buildtime fill:#D1E8E2,stroke:#1E8555,color:#1E5532;
    classDef deploy fill:#ECEFF1,stroke:#90A4AE,color:#455A64;
    classDef runtime fill:#E8F5E9,stroke:#43A047,color:#1B5E20;
    classDef data fill:#FFF3E0,stroke:#FFB300,color:#E65100;
    classDef external fill:#FFF8E1,stroke:#FFC107,color:#E65100;
```
