# dam2323/the-space-archive architecture

> Architecture diagram of the GitHub repository dam2323/the-space-archive, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dam2323/the-space-archive
- Repository: https://github.com/dam2323/the-space-archive

## Overview

The Space Archive is a static, educational browser game. The player enters through the title and time-travel introduction, explores the Archive hub, chooses a machine’s story and mini-game, then reads its historical debrief; optional branches cover scannable echoes, the Science Room, and the Wall of Names. The graph includes the five distinct machine games and the shared scene, input, rendering, state, persistence, and content layers. Several connections are documented in the README or visible in the source index; unsampled details are not inferred.

Main entry points: [`js/main.js`](https://github.com/dam2323/the-space-archive/blob/main/js/main.js) (Game entry), [`js/scenes/hub.js`](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/hub.js) (Archive hub), [`js/minigames/index.js`](https://github.com/dam2323/the-space-archive/blob/main/js/minigames/index.js) (Mini-game registry), [`js/engine/scenes.js`](https://github.com/dam2323/the-space-archive/blob/main/js/engine/scenes.js) (Scene manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Player experience"]
  node_entry["Game entry<br/>[main.js]"]
  node_title["Title and options<br/>[title.js]"]
  node_intro["Time-travel intro<br/>[intro.js]"]
  node_hub["Archive hub<br/>[hub.js]"]
  node_story["Machine stories<br/>[story.js]"]
  node_game["Mini-game shell<br/>[game.js]"]
  node_debrief["Historical debrief<br/>[debrief.js]"]
  node_echo["Echo fact cards<br/>[echo.js]"]
  node_science["Science Room<br/>[science.js]"]
  node_wall["Wall of Names<br/>[wall.js]"]
  node_credits["Credits and sources<br/>[credits.js]"]
end

subgraph group_missions["Machine mini-games"]
  node_opportunity["Opportunity<br/>[opportunity.js]"]
  node_ingenuity["Ingenuity<br/>[ingenuity.js]"]
  node_sojourner["Sojourner<br/>[sojourner.js]"]
  node_lrv["Lunar Roving Vehicle<br/>[lrv.js]"]
  node_pioneer["Pioneer 10<br/>[pioneer10.js]"]
  node_dispatch["Mini-game registry<br/>[index.js]"]
end

subgraph group_engine["Game engine"]
  node_scene_manager["Scene manager<br/>[scenes.js]"]
  node_input["Input handling<br/>[input.js]"]
  node_render["Canvas renderer<br/>[render.js]"]
  node_storage[("Progress storage<br/>[storage.js]")]
end

subgraph group_content["Content and state"]
  node_state["Game state<br/>[state.js]"]
  node_content_data["Localized content<br/>[content.en.js]"]
  node_translations["Spanish content<br/>[content.es.js]"]
  node_sources["Fact sources<br/>[sources.js]"]
  node_sprites["Pixel sprites<br/>[sprites.js]"]
  node_science_data["Palette data<br/>[palette.js]"]
end

node_player(("Player"))

node_player -->|"opens"| node_entry
node_entry -->|"registers scenes"| node_scene_manager
node_entry -->|"initializes input"| node_input
node_entry -->|"loads progress"| node_storage
node_title -->|"starts journey"| node_intro
node_intro -->|"arrives at Archive"| node_hub
node_hub -->|"selects machine"| node_story
node_story -->|"starts mini-game"| node_game
node_game -->|"selects game"| node_dispatch
node_dispatch -->|"routes to"| node_opportunity
node_dispatch -->|"routes to"| node_ingenuity
node_dispatch -->|"routes to"| node_sojourner
node_dispatch -->|"routes to"| node_lrv
node_dispatch -->|"routes to"| node_pioneer
node_game -->|"shows result"| node_debrief
node_hub -->|"opens echo"| node_echo
node_hub -->|"opens room"| node_science
node_hub -->|"opens list"| node_wall
node_title -->|"opens credits"| node_credits
node_entry -->|"starts loop"| node_scene_manager
node_scene_manager -->|"draws scenes"| node_render
node_scene_manager -.->|"routes actions"| node_input
node_storage -->|"loads and saves"| node_state
node_entry -->|"initializes settings"| node_state
node_hub -->|"reads progress"| node_state
node_debrief -->|"filters citations"| node_sources
node_credits -->|"reads citations"| node_sources
node_science -->|"reads facts"| node_content_data
node_wall -->|"reads descriptions"| node_content_data
node_entry -->|"loads language"| node_content_data
node_entry -->|"loads language"| node_translations
node_hub -->|"draws machines"| node_sprites
node_render -->|"uses palette"| node_science_data
node_hub -->|"changes scenes"| node_scene_manager

click node_entry "https://github.com/dam2323/the-space-archive/blob/main/js/main.js"
click node_title "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/title.js"
click node_intro "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/intro.js"
click node_hub "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/hub.js"
click node_story "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/story.js"
click node_game "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/game.js"
click node_debrief "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/debrief.js"
click node_echo "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/echo.js"
click node_science "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/science.js"
click node_wall "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/wall.js"
click node_credits "https://github.com/dam2323/the-space-archive/blob/main/js/scenes/credits.js"
click node_opportunity "https://github.com/dam2323/the-space-archive/blob/main/js/minigames/opportunity.js"
click node_ingenuity "https://github.com/dam2323/the-space-archive/blob/main/js/minigames/ingenuity.js"
click node_sojourner "https://github.com/dam2323/the-space-archive/blob/main/js/minigames/sojourner.js"
click node_lrv "https://github.com/dam2323/the-space-archive/blob/main/js/minigames/lrv.js"
click node_pioneer "https://github.com/dam2323/the-space-archive/blob/main/js/minigames/pioneer10.js"
click node_dispatch "https://github.com/dam2323/the-space-archive/blob/main/js/minigames/index.js"
click node_scene_manager "https://github.com/dam2323/the-space-archive/blob/main/js/engine/scenes.js"
click node_input "https://github.com/dam2323/the-space-archive/blob/main/js/engine/input.js"
click node_render "https://github.com/dam2323/the-space-archive/blob/main/js/engine/render.js"
click node_storage "https://github.com/dam2323/the-space-archive/blob/main/js/engine/storage.js"
click node_state "https://github.com/dam2323/the-space-archive/blob/main/js/state.js"
click node_content_data "https://github.com/dam2323/the-space-archive/blob/main/js/data/content.en.js"
click node_translations "https://github.com/dam2323/the-space-archive/blob/main/js/data/content.es.js"
click node_sources "https://github.com/dam2323/the-space-archive/blob/main/js/data/sources.js"
click node_sprites "https://github.com/dam2323/the-space-archive/blob/main/js/data/sprites.js"
click node_science_data "https://github.com/dam2323/the-space-archive/blob/main/js/data/palette.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_entry,node_title,node_intro,node_hub,node_story,node_game,node_debrief,node_echo,node_science,node_wall,node_credits toneBlue
class node_opportunity,node_ingenuity,node_sojourner,node_lrv,node_pioneer,node_dispatch toneAmber
class node_scene_manager,node_input,node_render,node_storage toneMint
class node_state,node_content_data,node_translations,node_sources,node_sprites,node_science_data toneRose
class node_player toneIndigo
```

## Components

### Player experience

- [Game entry](https://github.com/dam2323/the-space-archive/blob/main/js/main.js): `js/main.js`
- [Title and options](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/title.js): `js/scenes/title.js`
- [Time-travel intro](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/intro.js): `js/scenes/intro.js`
- [Archive hub](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/hub.js): `js/scenes/hub.js`
- [Machine stories](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/story.js): `js/scenes/story.js`
- [Mini-game shell](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/game.js): `js/scenes/game.js`
- [Historical debrief](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/debrief.js): `js/scenes/debrief.js`
- [Echo fact cards](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/echo.js): `js/scenes/echo.js`
- [Science Room](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/science.js): `js/scenes/science.js`
- [Wall of Names](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/wall.js): `js/scenes/wall.js`
- [Credits and sources](https://github.com/dam2323/the-space-archive/blob/main/js/scenes/credits.js): `js/scenes/credits.js`

### Machine mini-games

- [Opportunity](https://github.com/dam2323/the-space-archive/blob/main/js/minigames/opportunity.js): `js/minigames/opportunity.js`
- [Ingenuity](https://github.com/dam2323/the-space-archive/blob/main/js/minigames/ingenuity.js): `js/minigames/ingenuity.js`
- [Sojourner](https://github.com/dam2323/the-space-archive/blob/main/js/minigames/sojourner.js): `js/minigames/sojourner.js`
- [Lunar Roving Vehicle](https://github.com/dam2323/the-space-archive/blob/main/js/minigames/lrv.js): `js/minigames/lrv.js`
- [Pioneer 10](https://github.com/dam2323/the-space-archive/blob/main/js/minigames/pioneer10.js): `js/minigames/pioneer10.js`
- [Mini-game registry](https://github.com/dam2323/the-space-archive/blob/main/js/minigames/index.js): `js/minigames/index.js`

### Game engine

- [Scene manager](https://github.com/dam2323/the-space-archive/blob/main/js/engine/scenes.js): `js/engine/scenes.js`
- [Input handling](https://github.com/dam2323/the-space-archive/blob/main/js/engine/input.js): `js/engine/input.js`
- [Canvas renderer](https://github.com/dam2323/the-space-archive/blob/main/js/engine/render.js): `js/engine/render.js`
- [Progress storage](https://github.com/dam2323/the-space-archive/blob/main/js/engine/storage.js): `js/engine/storage.js`

### Content and state

- [Game state](https://github.com/dam2323/the-space-archive/blob/main/js/state.js): `js/state.js`
- [Localized content](https://github.com/dam2323/the-space-archive/blob/main/js/data/content.en.js): `js/data/content.en.js`
- [Spanish content](https://github.com/dam2323/the-space-archive/blob/main/js/data/content.es.js): `js/data/content.es.js`
- [Fact sources](https://github.com/dam2323/the-space-archive/blob/main/js/data/sources.js): `js/data/sources.js`
- [Pixel sprites](https://github.com/dam2323/the-space-archive/blob/main/js/data/sprites.js): `js/data/sprites.js`
- [Palette data](https://github.com/dam2323/the-space-archive/blob/main/js/data/palette.js): `js/data/palette.js`

### Other components

- **Player**

## Connections

- Player → Game entry: opens (evidence: `README.md`)
- Game entry → Scene manager: registers scenes (evidence: `js/main.js`)
- Game entry → Input handling: initializes input (evidence: `js/main.js`)
- Game entry → Progress storage: loads progress (evidence: `js/main.js`)
- Title and options → Time-travel intro: starts journey (evidence: `js/scenes/title.js`)
- Time-travel intro → Archive hub: arrives at Archive (evidence: `README.md`)
- Archive hub → Machine stories: selects machine (evidence: `README.md`)
- Machine stories → Mini-game shell: starts mini-game (evidence: `js/scenes/story.js`)
- Mini-game shell → Mini-game registry: selects game (evidence: `js/scenes/game.js`)
- Mini-game registry → Opportunity: routes to (evidence: `js/minigames/index.js`)
- Mini-game registry → Ingenuity: routes to (evidence: `js/minigames/index.js`)
- Mini-game registry → Sojourner: routes to (evidence: `js/minigames/index.js`)
- Mini-game registry → Lunar Roving Vehicle: routes to (evidence: `js/minigames/index.js`)
- Mini-game registry → Pioneer 10: routes to (evidence: `js/minigames/index.js`)
- Mini-game shell → Historical debrief: shows result (evidence: `README.md`)
- Archive hub → Echo fact cards: opens echo (evidence: `README.md`)
- Archive hub → Science Room: opens room (evidence: `README.md`)
- Archive hub → Wall of Names: opens list (evidence: `README.md`)
- Title and options → Credits and sources: opens credits (evidence: `README.md`)
- Game entry → Scene manager: starts loop (evidence: `js/main.js`)
- Scene manager → Canvas renderer: draws scenes (evidence: `js/engine/scenes.js`)
- Scene manager → Input handling: routes actions
- Progress storage → Game state: loads and saves (evidence: `js/engine/storage.js`)
- Game entry → Game state: initializes settings (evidence: `js/main.js`)
- Archive hub → Game state: reads progress (evidence: `js/scenes/hub.js`)
- Historical debrief → Fact sources: filters citations (evidence: `js/scenes/debrief.js`)
- Credits and sources → Fact sources: reads citations (evidence: `js/scenes/credits.js`)
- Science Room → Localized content: reads facts (evidence: `js/scenes/science.js`)
- Wall of Names → Localized content: reads descriptions (evidence: `js/scenes/wall.js`)
- Game entry → Localized content: loads language (evidence: `js/main.js`)
- Game entry → Spanish content: loads language (evidence: `js/main.js`)
- Archive hub → Pixel sprites: draws machines (evidence: `js/scenes/hub.js`)
- Canvas renderer → Palette data: uses palette (evidence: `js/engine/render.js`)
- Archive hub → Scene manager: changes scenes (evidence: `js/scenes/hub.js`)
