# yousseffekryk98-droid/lego-ninjago-tournament architecture

> Architecture diagram of the GitHub repository yousseffekryk98-droid/lego-ninjago-tournament, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yousseffekryk98-droid/lego-ninjago-tournament
- Repository: https://github.com/yousseffekryk98-droid/lego-ninjago-tournament

## Overview

This is a browser-playable 3D LEGO Ninjago arena-brawler remake. The main player journey is choosing a fighter and mode, entering a combat or training session, and earning progression that persists locally. The map also preserves the documented roster, collection, loadout, challenge, rendering, and installable-offline capabilities. Relationships are limited to sampled imports/calls and README statements; some feature wiring and unsampled implementations are therefore shown only where documented.

Main entry points: [`src/app/main.ts`](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/app/main.ts) (Game interface), [`src/features/combat/TournamentGame.ts`](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/TournamentGame.ts) (Tournament combat), [`src/features/characters/model.ts`](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/model.ts) (Character model builder), [`src/features/dojo/DojoGame.ts`](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/dojo/DojoGame.ts) (Dojo tutorial)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Game application"]
  node_app["Game interface<br/>[main.ts]"]
  node_controls["Input controls<br/>[index.ts]"]
  node_gallery["Fighter gallery<br/>[index.ts]"]
  node_loadout["Loadout and items<br/>[index.ts]"]
end

subgraph group_fighters["Fighters and models"]
  node_roster["Roster catalog"]
  node_fighterdata["Fighter designs<br/>[designs.ts]"]
  node_elements["Elemental metadata<br/>[elemental.ts]"]
  node_profiles["Model profiles<br/>[model-profile.ts]"]
  node_character_model["Character model builder<br/>[model.ts]"]
  node_procedural_model["Procedural minifigures"]
  node_authored_model["Authored character bodies<br/>[authored-model.ts]"]
  node_glb["GLB asset loader<br/>[gltf-assets.ts]"]
end

subgraph group_play["Play modes"]
  node_combat["Tournament combat<br/>[TournamentGame.ts]"]
  node_contentgame["Content game mode<br/>[ContentGame.ts]"]
  node_arena["Arena floor<br/>[arena-floor.ts]"]
  node_hazards["Arena hazards<br/>[arena-hazards.ts]"]
  node_vfx["Elemental effects<br/>[element-vfx.ts]"]
  node_dojo["Dojo tutorial<br/>[DojoGame.ts]"]
  node_challenges["Challenge modes<br/>[index.ts]"]
end

subgraph group_shared["Player services"]
  node_progression["Fighter progression<br/>[index.ts]"]
  node_storage[("Local save sync<br/>[save-sync.ts]")]
end

subgraph group_runtime["Runtime support"]
  node_graphics["Graphics settings<br/>[index.ts]"]
  node_feedback["Feedback settings<br/>[index.ts]"]
  node_platform["Platform support<br/>[index.ts]"]
  node_serviceworker["Offline service worker<br/>[sw.js]"]
end

node_player(("Player"))

node_player -->|"uses"| node_app
node_app -->|"starts combat"| node_combat
node_app -->|"starts training"| node_dojo
node_app -->|"reads bindings"| node_controls
node_app -->|"selects fighters"| node_roster
node_app -->|"reads XP"| node_progression
node_app -.->|"opens archive"| node_gallery
node_app -.->|"sets loadout"| node_loadout
node_app -.->|"offers challenges"| node_challenges
node_combat -->|"builds floor"| node_arena
node_combat -->|"manages hazards"| node_hazards
node_combat -->|"spawns effects"| node_vfx
node_combat -->|"reads bindings"| node_controls
node_combat -->|"builds fighters"| node_character_model
node_contentgame -->|"builds fighters"| node_character_model
node_dojo -->|"builds fighters"| node_character_model
node_dojo -->|"reads bindings"| node_controls
node_character_model -->|"gets profile"| node_profiles
node_character_model -->|"gets design"| node_fighterdata
node_character_model -->|"builds model"| node_procedural_model
node_character_model -->|"attaches body"| node_authored_model
node_authored_model -->|"loads asset"| node_glb
node_combat -->|"gets element theme"| node_elements
node_vfx -->|"gets element data"| node_elements
node_app -.->|"persists progress"| node_storage
node_player -->|"chooses graphics"| node_graphics
node_player -.->|"sets feedback"| node_feedback
node_player -.->|"installs app"| node_platform
node_serviceworker -.->|"serves offline"| node_player

click node_app "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/app/main.ts"
click node_controls "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/controls/index.ts"
click node_roster "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/expanded-catalog.ts"
click node_fighterdata "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/designs.ts"
click node_elements "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/elemental.ts"
click node_profiles "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/model-profile.ts"
click node_character_model "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/model.ts"
click node_procedural_model "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/three/minifigure-model.ts"
click node_authored_model "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/authored-model.ts"
click node_glb "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/three/gltf-assets.ts"
click node_combat "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/TournamentGame.ts"
click node_contentgame "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/ContentGame.ts"
click node_arena "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/arena-floor.ts"
click node_hazards "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/arena-hazards.ts"
click node_vfx "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/element-vfx.ts"
click node_dojo "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/dojo/DojoGame.ts"
click node_challenges "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/challenges/index.ts"
click node_gallery "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/gallery/index.ts"
click node_loadout "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/loadout/index.ts"
click node_progression "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/progression/index.ts"
click node_storage "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/storage/save-sync.ts"
click node_graphics "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/graphics/index.ts"
click node_feedback "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/feedback/index.ts"
click node_platform "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/platform/index.ts"
click node_serviceworker "https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/public/sw.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_app,node_controls,node_gallery,node_loadout toneBlue
class node_roster,node_fighterdata,node_elements,node_profiles,node_character_model,node_procedural_model,node_authored_model,node_glb toneAmber
class node_combat,node_contentgame,node_arena,node_hazards,node_vfx,node_dojo,node_challenges toneMint
class node_progression,node_storage toneRose
class node_graphics,node_feedback,node_platform,node_serviceworker,node_player toneIndigo
```

## Components

### Game application

- [Game interface](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/app/main.ts): `src/app/main.ts`
- [Input controls](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/controls/index.ts): `src/features/controls/index.ts`
- [Fighter gallery](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/gallery/index.ts): `src/features/gallery/index.ts`
- [Loadout and items](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/loadout/index.ts): `src/features/loadout/index.ts`

### Fighters and models

- [Roster catalog](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/expanded-catalog.ts): `src/features/characters/expanded-catalog.ts`
- [Fighter designs](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/designs.ts): `src/features/characters/designs.ts`
- [Elemental metadata](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/elemental.ts): `src/features/characters/elemental.ts`
- [Model profiles](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/model-profile.ts): `src/features/characters/model-profile.ts`
- [Character model builder](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/model.ts): `src/features/characters/model.ts`
- [Procedural minifigures](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/three/minifigure-model.ts): `src/shared/three/minifigure-model.ts`
- [Authored character bodies](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/characters/authored-model.ts): `src/features/characters/authored-model.ts`
- [GLB asset loader](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/three/gltf-assets.ts): `src/shared/three/gltf-assets.ts`

### Play modes

- [Tournament combat](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/TournamentGame.ts): `src/features/combat/TournamentGame.ts`
- [Content game mode](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/ContentGame.ts): `src/features/combat/ContentGame.ts`
- [Arena floor](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/arena-floor.ts): `src/features/combat/arena-floor.ts`
- [Arena hazards](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/arena-hazards.ts): `src/features/combat/arena-hazards.ts`
- [Elemental effects](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/combat/element-vfx.ts): `src/features/combat/element-vfx.ts`
- [Dojo tutorial](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/dojo/DojoGame.ts): `src/features/dojo/DojoGame.ts`
- [Challenge modes](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/challenges/index.ts): `src/features/challenges/index.ts`

### Player services

- [Fighter progression](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/features/progression/index.ts): `src/features/progression/index.ts`
- [Local save sync](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/storage/save-sync.ts): `src/shared/storage/save-sync.ts`

### Runtime support

- [Graphics settings](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/graphics/index.ts): `src/shared/graphics/index.ts`
- [Feedback settings](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/feedback/index.ts): `src/shared/feedback/index.ts`
- [Platform support](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/src/shared/platform/index.ts): `src/shared/platform/index.ts`
- [Offline service worker](https://github.com/yousseffekryk98-droid/lego-ninjago-tournament/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Player**

## Connections

- Player → Game interface: uses
- Game interface → Tournament combat: starts combat (evidence: `src/app/main.ts`)
- Game interface → Dojo tutorial: starts training (evidence: `src/app/main.ts`)
- Game interface → Input controls: reads bindings (evidence: `src/app/main.ts`)
- Game interface → Roster catalog: selects fighters (evidence: `src/app/main.ts`)
- Game interface → Fighter progression: reads XP (evidence: `src/app/main.ts`)
- Game interface → Fighter gallery: opens archive
- Game interface → Loadout and items: sets loadout
- Game interface → Challenge modes: offers challenges
- Tournament combat → Arena floor: builds floor (evidence: `src/features/combat/TournamentGame.ts`)
- Tournament combat → Arena hazards: manages hazards (evidence: `src/features/combat/TournamentGame.ts`)
- Tournament combat → Elemental effects: spawns effects (evidence: `src/features/combat/TournamentGame.ts`)
- Tournament combat → Input controls: reads bindings (evidence: `src/features/combat/TournamentGame.ts`)
- Tournament combat → Character model builder: builds fighters (evidence: `src/features/combat/TournamentGame.ts`)
- Content game mode → Character model builder: builds fighters (evidence: `src/features/combat/ContentGame.ts`)
- Dojo tutorial → Character model builder: builds fighters (evidence: `src/features/dojo/DojoGame.ts`)
- Dojo tutorial → Input controls: reads bindings (evidence: `src/features/dojo/DojoGame.ts`)
- Character model builder → Model profiles: gets profile (evidence: `src/features/characters/model.ts`)
- Character model builder → Fighter designs: gets design (evidence: `src/features/characters/model.ts`)
- Character model builder → Procedural minifigures: builds model (evidence: `src/features/characters/model.ts`)
- Character model builder → Authored character bodies: attaches body (evidence: `src/features/characters/model.ts`)
- Authored character bodies → GLB asset loader: loads asset (evidence: `src/features/characters/authored-model.ts`)
- Tournament combat → Elemental metadata: gets element theme (evidence: `src/features/combat/TournamentGame.ts`)
- Elemental effects → Elemental metadata: gets element data (evidence: `src/features/combat/element-vfx.ts`)
- Game interface → Local save sync: persists progress
- Player → Graphics settings: chooses graphics
- Player → Feedback settings: sets feedback
- Player → Platform support: installs app
- Offline service worker → Player: serves offline
