# luong-15/new-year architecture

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

- Interactive diagram: https://gitdiagram.com/luong-15/new-year
- Repository: https://github.com/luong-15/new-year

## Overview

##### Project type and purpose
- This is a simple, static, front-end only “New Year Celebration” web page that renders JavaScript-powered fireworks in the browser. There is no backend or database—everything lives in the user’s browser.

##### File structure
- index.html: entry point that pulls in CSS and JS
- style.css: styling for the UI
- script.js: orchestration of fireworks logic and page interactivity
- MyMath.js: utility module for math functions (e.g., randomization, vector math)
- fscreen.1.0.1.js: utility for full-screen toggling
- README.md: high-level project description

##### README
- Confirms this is a UI-only project for entertainment
- Lists feature set (firework effects, festive UI)
- No mention of external services or build pipelines

##### Main components
a. Browser (the user’s environment)
b. index.html + CSS (static UI layer)
c. JavaScript modules:
- script.js (controller/orchestrator)
- Stage.0.1.4.js (rendering engine)
- MyMath.js (math utilities)
- fscreen.1.0.1.js (full-screen utility)
d. HTML5 Canvas API (render target)

##### Relationships and interactions
- Browser loads index.html → applies style.css → brings up UI shell
- index.html loads the JS files in order: MyMath.js → Stage.0.1.4.js → fscreen.1.0.1.js → script.js
- script.js can invoke fscreen API to toggle full screen via user input
- Stage module talks directly to Canvas API to paint frames

##### Architectural patterns and design principles
- Modular JavaScript: utilities (MyMath), engine (Stage), orchestrator (script.js)
- Clear separation between:
- UI (HTML+CSS)
- Core rendering (Stage)
- Business logic (script.js)
- Utilities (MyMath, fscreen)

##### Putting it all together
- At the top: “User’s Browser”
- Middle row:
[index.html] → branches to [style.css] and to the JS-load pipeline:
[MyMath.js] → [Stage.0.1.4.js] → [fscreen.1.0.1.js] → [script.js]
- Bottom row:
[Canvas API] (connected from Stage) → “Rendered Fireworks on Screen”

##### Important details to capture
- The sequence in which scripts are loaded
- The dependency of script.js on all other modules
- The fact that Stage is the only component talking to the Canvas API
- The toggling of full screen via fscreen

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser(("User's Browser")):::browser
    Index["index.html\n(UI Entry Point)"]:::ui
    Style["style.css\n(UI Stylesheet)"]:::ui
    Math["MyMath.js\n(Math Utilities)"]:::utility
    Engine["Stage.0.1.4.js\n(Rendering Engine)"]:::engine
    FS["fscreen.1.0.1.js\n(Full-Screen Utility)"]:::utility
    Script["script.js\n(Controller)"]:::logic
    Canvas["Canvas API\n(Render Target)"]:::api
    Render["Rendered Fireworks\non Screen"]:::output
    README["README.md\n(Project Documentation)"]:::doc

    Browser -->|loads| Index
    Index -->|loads| Style
    Index -->|loads| Math
    Math -->|required by| Engine
    Engine -->|loaded by| FS
    FS -->|loaded by| Script
    Script -->|calls| Math
    Script -->|calls| Engine
    Script -->|invokes| FS
    Engine -->|draws to| Canvas
    Canvas -->|renders| Render

    click Index "https://github.com/luong-15/new-year/blob/main/index.html"
    click Style "https://github.com/luong-15/new-year/blob/main/style.css"
    click Math "https://github.com/luong-15/new-year/blob/main/MyMath.js"
    click Engine "https://github.com/luong-15/new-year/blob/main/Stage.0.1.4.js"
    click FS "https://github.com/luong-15/new-year/blob/main/fscreen.1.0.1.js"
    click Script "https://github.com/luong-15/new-year/blob/main/script.js"
    click README "https://github.com/luong-15/new-year/blob/main/README.md"

    classDef ui fill:#b9f6ca,stroke:#006400,color:#000;
    classDef logic fill:#bbdefb,stroke:#0d47a1,color:#000;
    classDef utility fill:#fff59d,stroke:#f57f17,color:#000;
    classDef engine fill:#ffcc80,stroke:#e65100,color:#000;
    classDef api fill:#cfd8dc,stroke:#37474f,color:#000;
    classDef output fill:#e1bee7,stroke:#4a148c,color:#000;
    classDef browser fill:#e3f2fd,stroke:#1e88e5,color:#000;
    classDef doc fill:#f5f5f5,stroke:#9e9e9e,color:#000;
```
