# xand0dev/mars404 architecture

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

- Interactive diagram: https://gitdiagram.com/xand0dev/mars404
- Repository: https://github.com/xand0dev/mars404

## Overview

MARS//404 is an offline-first Marswalk planning app: choose a site, inspect its real terrain and science targets, build a route, assess whether the return fits life-support limits, and navigate or walk the plan. The runtime is a React app backed by shared mission state, terrain-routing algorithms, and locally packaged NASA-derived data; no backend is used. The graph preserves the documented preparation, crew-note, navigation, and globe-overview capabilities. Some feature internals are unsampled, so their documented connections are cited to the README rather than inferred from module names.

Main entry points: [`src/app/App.tsx`](https://github.com/xand0dev/mars404/blob/main/src/app/App.tsx) (App composition), [`src/store/useMission.ts`](https://github.com/xand0dev/mars404/blob/main/src/store/useMission.ts) (Mission state), [`src/features/budget/BudgetEngine.tsx`](https://github.com/xand0dev/mars404/blob/main/src/features/budget/BudgetEngine.tsx) (Return assessment), [`src/core/plan-route.ts`](https://github.com/xand0dev/mars404/blob/main/src/core/plan-route.ts) (Route search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Mission experience"]
  node_app["App composition<br/>[App.tsx]"]
  node_globe["Site selection<br/>[GlobeScene.tsx]"]
  node_targets["Science targets<br/>[TargetsPanel.tsx]"]
  node_prep["EVA checklist<br/>[ChecklistPanel.tsx]"]
  node_notes["Crew notes<br/>[NotesPanel.tsx]"]
  node_hud["Mission HUD<br/>[Hud.tsx]"]
  node_mission["Mission state<br/>[useMission.ts]"]
end

subgraph group_planning["Route and safety"]
  node_routeui["Route planning UI<br/>[RoutePanel.tsx]"]
  node_routeclient["Route client<br/>[route-client.ts]"]
  node_routecore["Route search<br/>[plan-route.ts]"]
  node_astar["A-star search<br/>[astar.ts]"]
  node_walkgraph["Walk cost graph<br/>[edge.ts]"]
  node_budgetengine["Return assessment<br/>[BudgetEngine.tsx]"]
  node_reach["Reachability model<br/>[reachability.ts]"]
  node_budget["Life-support budget<br/>[budget.ts]"]
  node_gonogo["GO / NO-GO<br/>[GoNoGo.tsx]"]
end

subgraph group_terrain["Terrain and navigation"]
  node_terrainview["Terrain map<br/>[MapView.tsx]"]
  node_walknav["3D route walk<br/>[useTraverse.ts]"]
  node_layers["Map layers<br/>[LayersPanel.tsx]"]
end

subgraph group_data["Mission data"]
  node_loader["Region data loader<br/>[loadRegion.ts]"]
  node_packages[("Static data packages")]
  node_pipeline["NASA data preparation<br/>[prepare.py]"]
  node_annotations[("Annotation storage<br/>[storage.ts]")]
  node_contracts["Mission data contracts<br/>[index.ts]"]
end

node_astronaut(("Astronaut"))

node_astronaut -->|"selects site"| node_globe
node_app -->|"mounts"| node_loader
node_app -->|"mounts"| node_budgetengine
node_app -->|"composes"| node_globe
node_app -->|"composes"| node_targets
node_app -->|"composes"| node_routeui
node_app -->|"composes"| node_terrainview
node_app -->|"composes"| node_layers
node_app -->|"composes"| node_hud
node_app -->|"composes"| node_prep
node_app -->|"composes"| node_notes
node_pipeline -->|"produces"| node_packages
node_packages -->|"loads offline"| node_loader
node_loader -.->|"sets region data"| node_mission
node_targets -.->|"selects targets"| node_mission
node_routeui -.->|"requests route"| node_routeclient
node_routeclient -->|"calls planner"| node_routecore
node_routecore -->|"searches paths"| node_astar
node_routecore -->|"builds costs"| node_walkgraph
node_budgetengine -->|"reads mission"| node_mission
node_budgetengine -->|"assesses return"| node_reach
node_reach -->|"builds trees"| node_walkgraph
node_reach -->|"checks limits"| node_budget
node_budgetengine -->|"publishes budget"| node_mission
node_hud -.->|"shows status"| node_gonogo
node_mission -.->|"drives traversal"| node_walknav
node_terrainview -.->|"shows route walk"| node_walknav
node_layers -.->|"changes map view"| node_terrainview
node_notes -.->|"saves marks"| node_annotations
node_annotations -.->|"restores marks"| node_mission
node_mission -->|"stores typed state"| node_contracts
node_astronaut -->|"builds route"| node_routeui
node_astronaut -->|"walks plan"| node_walknav
node_astronaut -->|"records hazards"| node_notes

click node_app "https://github.com/xand0dev/mars404/blob/main/src/app/App.tsx"
click node_globe "https://github.com/xand0dev/mars404/blob/main/src/features/globe/GlobeScene.tsx"
click node_targets "https://github.com/xand0dev/mars404/blob/main/src/features/science/TargetsPanel.tsx"
click node_prep "https://github.com/xand0dev/mars404/blob/main/src/features/prep/ChecklistPanel.tsx"
click node_notes "https://github.com/xand0dev/mars404/blob/main/src/features/notes/NotesPanel.tsx"
click node_hud "https://github.com/xand0dev/mars404/blob/main/src/features/hud/Hud.tsx"
click node_mission "https://github.com/xand0dev/mars404/blob/main/src/store/useMission.ts"
click node_routeui "https://github.com/xand0dev/mars404/blob/main/src/features/route/RoutePanel.tsx"
click node_routeclient "https://github.com/xand0dev/mars404/blob/main/src/features/route/route-client.ts"
click node_routecore "https://github.com/xand0dev/mars404/blob/main/src/core/plan-route.ts"
click node_astar "https://github.com/xand0dev/mars404/blob/main/src/core/astar.ts"
click node_walkgraph "https://github.com/xand0dev/mars404/blob/main/src/core/edge.ts"
click node_budgetengine "https://github.com/xand0dev/mars404/blob/main/src/features/budget/BudgetEngine.tsx"
click node_reach "https://github.com/xand0dev/mars404/blob/main/src/core/reachability.ts"
click node_budget "https://github.com/xand0dev/mars404/blob/main/src/core/budget.ts"
click node_gonogo "https://github.com/xand0dev/mars404/blob/main/src/features/hud/GoNoGo.tsx"
click node_terrainview "https://github.com/xand0dev/mars404/blob/main/src/features/terrain/MapView.tsx"
click node_walknav "https://github.com/xand0dev/mars404/blob/main/src/features/terrain/useTraverse.ts"
click node_layers "https://github.com/xand0dev/mars404/blob/main/src/features/data/LayersPanel.tsx"
click node_loader "https://github.com/xand0dev/mars404/blob/main/src/features/data/loadRegion.ts"
click node_packages "https://github.com/xand0dev/mars404/tree/main/public/data"
click node_pipeline "https://github.com/xand0dev/mars404/blob/main/pipeline/prepare.py"
click node_annotations "https://github.com/xand0dev/mars404/blob/main/src/features/notes/storage.ts"
click node_contracts "https://github.com/xand0dev/mars404/blob/main/src/contracts/index.ts"

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_globe,node_targets,node_prep,node_notes,node_hud,node_mission toneBlue
class node_routeui,node_routeclient,node_routecore,node_astar,node_walkgraph,node_budgetengine,node_reach,node_budget,node_gonogo toneAmber
class node_terrainview,node_walknav,node_layers toneMint
class node_loader,node_packages,node_pipeline,node_annotations,node_contracts toneRose
class node_astronaut toneIndigo
```

## Components

### Mission experience

- [App composition](https://github.com/xand0dev/mars404/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Site selection](https://github.com/xand0dev/mars404/blob/main/src/features/globe/GlobeScene.tsx): `src/features/globe/GlobeScene.tsx`
- [Science targets](https://github.com/xand0dev/mars404/blob/main/src/features/science/TargetsPanel.tsx): `src/features/science/TargetsPanel.tsx`
- [EVA checklist](https://github.com/xand0dev/mars404/blob/main/src/features/prep/ChecklistPanel.tsx): `src/features/prep/ChecklistPanel.tsx`
- [Crew notes](https://github.com/xand0dev/mars404/blob/main/src/features/notes/NotesPanel.tsx): `src/features/notes/NotesPanel.tsx`
- [Mission HUD](https://github.com/xand0dev/mars404/blob/main/src/features/hud/Hud.tsx): `src/features/hud/Hud.tsx`
- [Mission state](https://github.com/xand0dev/mars404/blob/main/src/store/useMission.ts): `src/store/useMission.ts`

### Route and safety

- [Route planning UI](https://github.com/xand0dev/mars404/blob/main/src/features/route/RoutePanel.tsx): `src/features/route/RoutePanel.tsx`
- [Route client](https://github.com/xand0dev/mars404/blob/main/src/features/route/route-client.ts): `src/features/route/route-client.ts`
- [Route search](https://github.com/xand0dev/mars404/blob/main/src/core/plan-route.ts): `src/core/plan-route.ts`
- [A-star search](https://github.com/xand0dev/mars404/blob/main/src/core/astar.ts): `src/core/astar.ts`
- [Walk cost graph](https://github.com/xand0dev/mars404/blob/main/src/core/edge.ts): `src/core/edge.ts`
- [Return assessment](https://github.com/xand0dev/mars404/blob/main/src/features/budget/BudgetEngine.tsx): `src/features/budget/BudgetEngine.tsx`
- [Reachability model](https://github.com/xand0dev/mars404/blob/main/src/core/reachability.ts): `src/core/reachability.ts`
- [Life-support budget](https://github.com/xand0dev/mars404/blob/main/src/core/budget.ts): `src/core/budget.ts`
- [GO / NO-GO](https://github.com/xand0dev/mars404/blob/main/src/features/hud/GoNoGo.tsx): `src/features/hud/GoNoGo.tsx`

### Terrain and navigation

- [Terrain map](https://github.com/xand0dev/mars404/blob/main/src/features/terrain/MapView.tsx): `src/features/terrain/MapView.tsx`
- [3D route walk](https://github.com/xand0dev/mars404/blob/main/src/features/terrain/useTraverse.ts): `src/features/terrain/useTraverse.ts`
- [Map layers](https://github.com/xand0dev/mars404/blob/main/src/features/data/LayersPanel.tsx): `src/features/data/LayersPanel.tsx`

### Mission data

- [Region data loader](https://github.com/xand0dev/mars404/blob/main/src/features/data/loadRegion.ts): `src/features/data/loadRegion.ts`
- [Static data packages](https://github.com/xand0dev/mars404/tree/main/public/data): `public/data`
- [NASA data preparation](https://github.com/xand0dev/mars404/blob/main/pipeline/prepare.py): `pipeline/prepare.py`
- [Annotation storage](https://github.com/xand0dev/mars404/blob/main/src/features/notes/storage.ts): `src/features/notes/storage.ts`
- [Mission data contracts](https://github.com/xand0dev/mars404/blob/main/src/contracts/index.ts): `src/contracts/index.ts`

### Other components

- **Astronaut**

## Connections

- Astronaut → Site selection: selects site (evidence: `README.md`)
- App composition → Region data loader: mounts (evidence: `src/app/App.tsx`)
- App composition → Return assessment: mounts (evidence: `src/app/App.tsx`)
- App composition → Site selection: composes (evidence: `src/app/App.tsx`)
- App composition → Science targets: composes (evidence: `src/app/App.tsx`)
- App composition → Route planning UI: composes (evidence: `src/app/App.tsx`)
- App composition → Terrain map: composes (evidence: `src/app/App.tsx`)
- App composition → Map layers: composes (evidence: `src/app/App.tsx`)
- App composition → Mission HUD: composes (evidence: `src/app/App.tsx`)
- App composition → EVA checklist: composes (evidence: `src/app/App.tsx`)
- App composition → Crew notes: composes (evidence: `src/app/App.tsx`)
- NASA data preparation → Static data packages: produces (evidence: `README.md`)
- Static data packages → Region data loader: loads offline (evidence: `README.md`)
- Region data loader → Mission state: sets region data
- Science targets → Mission state: selects targets
- Route planning UI → Route client: requests route
- Route client → Route search: calls planner (evidence: `src/features/route/route-client.ts`)
- Route search → A-star search: searches paths (evidence: `src/core/plan-route.ts`)
- Route search → Walk cost graph: builds costs (evidence: `src/core/plan-route.ts`)
- Return assessment → Mission state: reads mission (evidence: `src/features/budget/BudgetEngine.tsx`)
- Return assessment → Reachability model: assesses return (evidence: `src/features/budget/BudgetEngine.tsx`)
- Reachability model → Walk cost graph: builds trees (evidence: `src/core/reachability.ts`)
- Reachability model → Life-support budget: checks limits (evidence: `src/core/reachability.ts`)
- Return assessment → Mission state: publishes budget (evidence: `src/features/budget/BudgetEngine.tsx`)
- Mission HUD → GO / NO-GO: shows status
- Mission state → 3D route walk: drives traversal
- Terrain map → 3D route walk: shows route walk
- Map layers → Terrain map: changes map view
- Crew notes → Annotation storage: saves marks
- Annotation storage → Mission state: restores marks
- Mission state → Mission data contracts: stores typed state (evidence: `src/store/useMission.ts`)
- Astronaut → Route planning UI: builds route (evidence: `README.md`)
- Astronaut → 3D route walk: walks plan (evidence: `README.md`)
- Astronaut → Crew notes: records hazards (evidence: `README.md`)
