# angeloov/airplane-game-threejs architecture

> Architecture diagram of the GitHub repository angeloov/airplane-game-threejs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/angeloov/airplane-game-threejs
- Repository: https://github.com/angeloov/airplane-game-threejs

## Overview

1. **Project type and boundary**
   - This is a **client-side 3D scene project** built with **Three.js** and bundled by **Webpack**.
   - There is **no backend or API layer** in the repository; the whole application runs in the browser and renders to WebGL.

2. **Application bootstrap**
   - `src/entry.js` is the main runtime entry point.
   - It likely creates the renderer, camera, resize/mouse listeners, and the animation loop, then mounts the scene into the page.
   - This is the highest-level orchestration layer and the best place to anchor the architecture diagram.

3. **Scene composition**
   - `src/objects/Scene.js` is the central composition module.
   - It assembles the world by instantiating and arranging the scene objects and lighting.
   - In diagram terms, this is the “scene graph root” or composition boundary that owns the renderable entities.

4. **Renderable object modules**
   - `src/objects/` contains isolated 3D entity definitions:
     - `Earth.js`
     - `Airplane.js`
     - `Cloud.js`
     - `Coin.js`
     - `Asteroid.js`
   - Each module appears to encapsulate one logical object type, including geometry/model loading, transforms, and any motion behavior.
   - This separation lets the scene compose reusable objects without putting their implementation details into the bootstrap.

5. **Asset-driven rendering**
   - The visual content is driven by local 3D model assets under `src/models/`.
   - The repo includes both **FBX** and **GLB** formats, plus a cloud model subfolder:
     - `Airplane.fbx`
     - `Coin.fbx`
     - `Earth.glb`
     - `Plane.glb`
     - `clouds/Cloud_1.fbx` through `Cloud_4.fbx`
   - These are imported as static resources and loaded asynchronously into Three.js at runtime.

6. **Utility layer**
   - `src/lib/utils.js` is the shared helper layer.
   - This is likely where cross-cutting math or scene helpers live, such as randomization, formatting, or object placement utilities.
   - Keep this as a low-level dependency used by object modules rather than by the app entry point directly.

7. **Styling and presentation**
   - `src/styles.js` handles page-level styling for the canvas/container and any overlay UI.
   - Since the app is a 3D renderer rather than a traditional UI, styling is likely thin and focused on layout, fullscreen behavior, and preventing browser defaults from interfering with the canvas.

8. **Static assets and fonts**
   - `src/fonts/` is present for typography assets, suggesting there may be text/UI overlays or future HUD elements.
   - The architecture is still centered on the canvas; fonts are auxiliary, not core rendering infrastructure.

9. **Build and packaging pipeline**
   - `webpack.config.js` defines the bundling pipeline for JavaScript and asset imports.
   - The build output in `build/` shows the result of that pipeline: a compiled JS bundle, source map, HTML entry point, and emitted model files.
   - This means the asset pipeline is important: models are not fetched from a remote service, they are bundled/copied into deployable static files.

10. **Runtime data flow**
    - Browser loads `build/index.html` or the dev server page.
    - Webpack bundle executes `src/entry.js`.
    - `entry.js` creates the renderer/camera and instantiates `Scene`.
    - `Scene` pulls in object modules, which in turn load local model assets and attach meshes to the Three.js scene.
    - The animation loop updates transforms and re-renders each frame.

11. **Deployment shape**
    - The repo produces a **static web artifact** in `build/`.
    - Deployment is just serving those built files from any static host; no server-side rendering or application state service is involved.

12. **Architecture summary**
    - Conceptually, this repo is organized as:
      - **Bootstrap**: `entry.js`
      - **Composition**: `Scene.js`
      - **Domain objects**: individual files in `objects/`
      - **Shared helpers**: `lib/utils.js`
      - **Assets**: `models/`, `fonts/`
      - **Delivery**: Webpack output in `build/`
    - For a diagram, the primary dependencies are from bootstrap → scene composition → object modules → static model assets, with Webpack sitting underneath as the packaging/runtime delivery layer.

Main entry points: [`src/objects/Scene.js`](https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Scene.js) (Scene), [`src/models`](https://github.com/angeloov/airplane-game-threejs/tree/main/src/models) (Models), [`src/entry.js`](https://github.com/angeloov/airplane-game-threejs/blob/main/src/entry.js) (Entry), [`build`](https://github.com/angeloov/airplane-game-threejs/tree/main/build) (Build)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_src_entry["Entry<br/>bootstrap<br/>[entry.js]"]
  node_src_styles["Styles<br/>presentation<br/>[styles.js]"]
  node_src_utils["Utils<br/>helpers<br/>[utils.js]"]
end

subgraph group_objects["Objects"]
  node_src_scene["Scene<br/>composition<br/>[Scene.js]"]
  node_src_earth["Earth<br/>3d object<br/>[Earth.js]"]
  node_src_airplane["Airplane<br/>3d object<br/>[Airplane.js]"]
  node_src_cloud["Cloud<br/>3d object<br/>[Cloud.js]"]
  node_src_coin["Coin<br/>3d object<br/>[Coin.js]"]
  node_src_asteroid["Asteroid<br/>3d object<br/>[Asteroid.js]"]
end

subgraph group_assets["Assets"]
  node_src_models[("Models<br/>asset set")]
  node_src_cloud_models[("Cloud Models<br/>asset folder")]
  node_src_fonts[("Fonts<br/>asset set")]
end

subgraph group_delivery["Delivery"]
  node_webpack_config["Webpack<br/>build config<br/>[webpack.config.js]"]
  node_build_dir[("Build<br/>static output")]
  node_build_html["Index HTML<br/>entry html<br/>[index.html]"]
  node_build_bundle["Main bundle<br/>js bundle"]
end

node_src_entry -->|"creates"| node_src_scene
node_src_entry -->|"loads"| node_src_styles
node_src_entry -->|"bundled by"| node_webpack_config
node_src_scene -->|"includes"| node_src_earth
node_src_scene -->|"includes"| node_src_airplane
node_src_scene -->|"includes"| node_src_cloud
node_src_scene -->|"includes"| node_src_coin
node_src_scene -->|"includes"| node_src_asteroid
node_src_scene -->|"uses"| node_src_utils
node_src_earth -->|"loads"| node_src_models
node_src_airplane -->|"loads"| node_src_models
node_src_coin -->|"loads"| node_src_models
node_src_cloud -->|"loads"| node_src_cloud_models
node_src_asteroid -->|"loads"| node_src_models
node_webpack_config -->|"emits"| node_build_dir
node_build_dir -->|"contains"| node_build_html
node_build_dir -->|"contains"| node_build_bundle
node_src_fonts -.->|"supports"| node_src_styles

click node_src_entry "https://github.com/angeloov/airplane-game-threejs/blob/main/src/entry.js"
click node_src_styles "https://github.com/angeloov/airplane-game-threejs/blob/main/src/styles.js"
click node_src_utils "https://github.com/angeloov/airplane-game-threejs/blob/main/src/lib/utils.js"
click node_src_scene "https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Scene.js"
click node_src_earth "https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Earth.js"
click node_src_airplane "https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Airplane.js"
click node_src_cloud "https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Cloud.js"
click node_src_coin "https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Coin.js"
click node_src_asteroid "https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Asteroid.js"
click node_src_models "https://github.com/angeloov/airplane-game-threejs/tree/main/src/models"
click node_src_cloud_models "https://github.com/angeloov/airplane-game-threejs/tree/main/src/models/clouds"
click node_src_fonts "https://github.com/angeloov/airplane-game-threejs/tree/main/src/fonts"
click node_webpack_config "https://github.com/angeloov/airplane-game-threejs/blob/main/webpack.config.js"
click node_build_dir "https://github.com/angeloov/airplane-game-threejs/tree/main/build"
click node_build_html "https://github.com/angeloov/airplane-game-threejs/blob/main/build/index.html"
click node_build_bundle "https://github.com/angeloov/airplane-game-threejs/blob/main/build/main.c558247a24de2bb6d358.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_src_entry,node_src_styles,node_src_utils toneBlue
class node_src_scene,node_src_earth,node_src_airplane,node_src_cloud,node_src_coin,node_src_asteroid toneAmber
class node_src_models,node_src_cloud_models,node_src_fonts toneMint
class node_webpack_config,node_build_dir,node_build_html,node_build_bundle toneRose
```

## Components

### Runtime

Browser-executed Three.js application and its orchestration layer.

- [Entry](https://github.com/angeloov/airplane-game-threejs/blob/main/src/entry.js): bootstrap · Main browser entry that initializes rendering and the animation loop. · `src/entry.js`
- [Styles](https://github.com/angeloov/airplane-game-threejs/blob/main/src/styles.js): presentation · Page and canvas styling for the browser runtime. · `src/styles.js`
- [Utils](https://github.com/angeloov/airplane-game-threejs/blob/main/src/lib/utils.js): helpers · Shared math and scene helpers used by object modules. · `src/lib/utils.js`

### Objects

Scene composition and reusable renderable entities.

- [Scene](https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Scene.js): composition · Top-level scene assembly and renderable world composition. · `src/objects/Scene.js`
- [Earth](https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Earth.js): 3d object · Earth entity with model loading and object behavior. · `src/objects/Earth.js`
- [Airplane](https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Airplane.js): 3d object · Airplane entity and its motion/model setup. · `src/objects/Airplane.js`
- [Cloud](https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Cloud.js): 3d object · Cloud entity built from local cloud model assets. · `src/objects/Cloud.js`
- [Coin](https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Coin.js): 3d object · Coin entity and animation/model wiring. · `src/objects/Coin.js`
- [Asteroid](https://github.com/angeloov/airplane-game-threejs/blob/main/src/objects/Asteroid.js): 3d object · Asteroid entity used as an in-world obstacle or prop. · `src/objects/Asteroid.js`

### Assets

Static models and auxiliary presentation assets consumed at runtime.

- [Models](https://github.com/angeloov/airplane-game-threejs/tree/main/src/models): asset set · Source 3D model assets bundled into the client build. · `src/models`
- [Cloud Models](https://github.com/angeloov/airplane-game-threejs/tree/main/src/models/clouds): asset folder · Cloud-specific FBX assets used by the cloud object. · `src/models/clouds`
- [Fonts](https://github.com/angeloov/airplane-game-threejs/tree/main/src/fonts): asset set · Typography assets for overlays or future HUD text. · `src/fonts`

### Delivery

Webpack build artifacts and packaging output.

- [Webpack](https://github.com/angeloov/airplane-game-threejs/blob/main/webpack.config.js): build config · Bundling and asset pipeline configuration. · `webpack.config.js`
- [Build](https://github.com/angeloov/airplane-game-threejs/tree/main/build): static output · Compiled deployable browser artifact set. · `build`
- [Index HTML](https://github.com/angeloov/airplane-game-threejs/blob/main/build/index.html): entry html · Static HTML entry point for the bundled app. · `build/index.html`
- [Main bundle](https://github.com/angeloov/airplane-game-threejs/blob/main/build/main.c558247a24de2bb6d358.js): js bundle · Compiled application bundle executed in the browser. · `build/main.c558247a24de2bb6d358.js`

## Connections

- Entry → Scene: creates · Bootstrap instantiates the scene composition.
- Entry → Styles: loads · Entry applies page-level styling.
- Entry → Webpack: bundled by · Webpack packages the entry into the client build.
- Scene → Earth: includes · Scene composes the Earth entity.
- Scene → Airplane: includes · Scene composes the airplane entity.
- Scene → Cloud: includes · Scene composes cloud entities.
- Scene → Coin: includes · Scene composes the coin entity.
- Scene → Asteroid: includes · Scene composes the asteroid entity.
- Scene → Utils: uses · Scene and object placement rely on shared helpers.
- Earth → Models: loads · Earth object consumes bundled model assets.
- Airplane → Models: loads · Airplane object consumes bundled model assets.
- Coin → Models: loads · Coin object consumes bundled model assets.
- Cloud → Cloud Models: loads · Cloud object consumes cloud FBX assets.
- Asteroid → Models: loads · Asteroid object consumes bundled model assets.
- Webpack → Build: emits · Webpack produces the deployable build output.
- Build → Index HTML: contains · Static HTML entry is part of the output bundle set.
- Build → Main bundle: contains · Compiled JavaScript bundle is emitted into build.
- Fonts → Styles: supports · Font assets support any presentation-layer text rendering.
