# nasu0604/returngamesite architecture

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

- Interactive diagram: https://gitdiagram.com/nasu0604/returngamesite
- Repository: https://github.com/nasu0604/returngamesite

## Overview

##### Project type and purpose
- This is a full-stack “lite” application in the sense that it has no custom backend or microservices. It’s a single-page application (SPA) built with React (Create-React-App) that lives entirely in the browser and is delivered via Firebase Hosting.
- Purpose: Showcase and serve multiple Unity WebGL game builds (under public/unity/…) and provide a React-powered UI (in returngame/src) with static JSON data for projects and timelines.

##### Main components
a. Client Browser
- React SPA (App.js + supporting CSS, tests, static JSON under src/)
- Unity WebGL modules (under public/unity/…)
b. Firebase Hosting (CDN + SSL)
- Serves index.html, JavaScript bundles, static assets (images, JSON, Unity .data/.framework.js/.wasm, manifest, robots.txt, etc.)
- Optionally provides Firebase services via JS SDK in firebase.js (e.g., Analytics, Auth, Firestore if used in future)
c. Static Data Stores
- projects.json, timelineData.json in src/ (bundled)
- manifest.json, ads.txt, robots.txt (in public/)
d. (Optional) External Services
- Third-party links: Instagram, analytic trackers
- Unity’s online services (if configured via google-services JSON in some builds)

##### Relationships and data flow
- User’s browser → DNS/CDN → Firebase Hosting → serves React bundle & static Unity assets
- React app bootstraps → Loads local JSON → Renders UI
- On “play game” action → SPA loads the specific Unity loader .js → Instantiates WebGL canvas → Fetches .wasm/.data for that game
- (If configured) React calls Firebase APIs via firebase.js → e.g., Analytics events

##### Architectural patterns & design principles
- SPA pattern: A single HTML shell (public/index.html) and client-side routing (React Router if used)
- Static-site architecture: No server-side code, all heavy lifting in browser
- Micro-frontend flavor for Unity games: each Unity build is an independent bundle served from its own subdirectory
- Progressive enhancement: JSON data + static hosting enable basic functionality even if JS or Unity fails

- Static files (public/)
- Unity build directories
- Configuration (firebase.json)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Browser / Client" 
        direction TB
        ReactSPA["React SPA"]:::client
        UnityRuntime["Unity WebGL Runtime"]:::client
    end

    %% Application Assets Layer
    subgraph "Application Assets" 
        direction TB
        StaticJSON["Static JSON Data"]:::data
        FirebaseSDK["Firebase JS SDK"]:::client
        UnityBuilds["Unity WebGL Builds"]:::client
    end

    %% Infrastructure Layer
    subgraph "Firebase Hosting (CDN)" 
        direction TB
        HostingConfig["firebase.json & .firebaserc"]:::infra
        PublicFiles["Public Static Assets"]:::infra
    end

    %% External Services
    subgraph "External Services" 
        direction TB
        Instagram["Instagram"]:::external
        Analytics["Analytics Trackers"]:::external
    end

    %% Unity builds details
    subgraph "Unity WebGL Builds" 
        direction TB
        ANTIPITALISM["ANTIPITALISM"]:::client
        HealthRock["Health-the-rock"]:::client
        QUIZAVOID["QUIZAVOID"]:::client
        RasingTier["RasingTier"]:::client
        Trolling["Trolling"]:::client
        catch["catch"]:::client
        daedooSimulator["daedooSimulator"]:::client
        rG_A["rG_A"]:::client
        rG_B["rG_B"]:::client
        rG_D["rG_D"]:::client
        rG_E["rG_E"]:::client
        starcatch["starcatch"]:::client
        tetro_mok["tetro-mok"]:::client
    end

    %% Public static
    subgraph "Public Static Assets" 
        direction TB
        IndexHTML["index.html"]:::infra
        Manifest["manifest.json"]:::infra
        Robots["robots.txt"]:::infra
        Ads["ads.txt"]:::infra
    end

    %% Hosting Config
    HostingConfig --> PublicFiles
    HostingConfig --> UnityBuilds

    %% Data sources
    StaticJSON --> ReactSPA
    FirebaseSDK --> ReactSPA

    %% Client interactions
    ReactSPA -->|"HTTP GET /index.html, bundle.js, static assets"| HostingConfig
    ReactSPA -->|"Load JSON"| StaticJSON
    ReactSPA -->|"Play Game"| UnityRuntime
    UnityRuntime -->|"Fetch .data/.wasm"| HostingConfig

    %% External
    ReactSPA -->|"Call JS SDK"| Analytics
    ReactSPA --> Instagram

    %% Directory flow
    HostingConfig --> IndexHTML
    HostingConfig --> Manifest
    HostingConfig --> Robots
    HostingConfig --> Ads

    %% Click Events for React SPA source
    click ReactSPA "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/App.js"
    click ReactSPA "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/index.js"
    click ReactSPA "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/index.css"
    click ReactSPA "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/App.css"
    click ReactSPA "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/App.test.js"
    click ReactSPA "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/reportWebVitals.js"
    click ReactSPA "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/setupTests.js"
    click StaticJSON "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/projects.json"
    click StaticJSON "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/timelineData.json"
    click FirebaseSDK "https://github.com/nasu0604/returngamesite/blob/main/returngame/src/firebase.js"

    %% Click Events for Hosting Config
    click HostingConfig "https://github.com/nasu0604/returngamesite/blob/main/returngame/firebase.json"
    click HostingConfig "https://github.com/nasu0604/returngamesite/blob/main/returngame/.firebaserc"
    click HostingConfig "https://github.com/nasu0604/returngamesite/blob/main/returngame/.firebase/hosting.YnVpbGQ.cache"

    %% Click Events for Public Static
    click IndexHTML "https://github.com/nasu0604/returngamesite/blob/main/returngame/public/index.html"
    click Manifest "https://github.com/nasu0604/returngamesite/blob/main/returngame/public/manifest.json"
    click Robots "https://github.com/nasu0604/returngamesite/blob/main/returngame/public/robots.txt"
    click Ads "https://github.com/nasu0604/returngamesite/blob/main/returngame/public/ads.txt"

    %% Click Events for Unity builds
    click ANTIPITALISM "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/ANTIPITALISM"
    click HealthRock "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/Health-the-rock"
    click QUIZAVOID "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/QUIZAVOID"
    click RasingTier "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/RasingTier"
    click Trolling "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/Trolling"
    click catch "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/catch"
    click daedooSimulator "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/daedooSimulator"
    click rG_A "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/rG_A"
    click rG_B "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/rG_B"
    click rG_D "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/rG_D"
    click rG_E "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/rG_E"
    click starcatch "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/starcatch"
    click tetro_mok "https://github.com/nasu0604/returngamesite/tree/main/returngame/public/unity/tetro-mok"

    %% Styles
    classDef client fill:#B3D1FF,stroke:#0366D6,color:#000;
    classDef infra fill:#FFE0B3,stroke:#D97706,color:#000;
    classDef data fill:#D1FFD6,stroke:#059669,color:#000;
    classDef external fill:#E5E7EB,stroke:#6B7280,color:#000;
```
