# slim40-jpg/restaurant-xr architecture

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

- Interactive diagram: https://gitdiagram.com/slim40-jpg/restaurant-xr
- Repository: https://github.com/slim40-jpg/restaurant-xr

## Overview

Restaurant XR is a browser-based 3D restaurant visit: guests explore the reconstructed El Nacional, discover and compare tables, inspect a menu, then explicitly reserve locally. It also offers VR, AR placement, and installable offline use. The graph preserves the documented capabilities and sampled call ownership; unsampled world builders and entry-point wiring are represented only where README or excerpts support them.

Main entry points: [`src/main.js`](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/main.js) (App bootstrap), [`src/xr/ar.js`](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/ar.js) (AR placement), [`src/interaction/first-person.js`](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/first-person.js) (First-person movement), [`src/world`](https://github.com/slim40-jpg/restaurant-xr/tree/main/src/world) (Restaurant reconstruction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Guest experience"]
  node_controls["Orbit and walk controls<br/>[controls.js]"]
  node_first_person["First-person movement<br/>[first-person.js]"]
  node_walk_math["Collision movement<br/>[walk-math.js]"]
  node_view_motion["Walking motion<br/>[view-motion.js]"]
  node_menu_list["Restaurant menu<br/>[menu-list.js]"]
  node_menu_data["Menu catalogue<br/>[menu.js]"]
  node_status["Status displays<br/>[status-fanout.js]"]
end

subgraph group_booking["Table discovery"]
  node_pointer["Pointer selection<br/>[pointer.js]"]
  node_selection["Table selection<br/>[selection.js]"]
  node_highlight["Table highlighting<br/>[highlight.js]"]
  node_preferences["Preference controls<br/>[preferences.js]"]
  node_recommend["Table recommendation<br/>[recommend.js]"]
  node_table_card["Table details and reserve<br/>[table-card.js]"]
end

subgraph group_world["Restaurant world"]
  node_world_plan["Room and table plan<br/>[layout.js]"]
  node_world_builders["Restaurant reconstruction"]
  node_walkable["Walkable surfaces<br/>[walkable.js]"]
end

subgraph group_runtime["Rendering and runtime"]
  node_bootstrap["App bootstrap<br/>[main.js]"]
  node_renderer["WebGPU renderer<br/>[renderer.js]"]
  node_scene["Scene and lighting<br/>[scene.js]"]
  node_webgpu_gate["WebGPU gate<br/>[webgpu-gate.js]"]
  node_pwa["Offline install<br/>[pwa.js]"]
end

subgraph group_xr["XR modes"]
  node_vr["VR controllers<br/>[controllers.js]"]
  node_ar["AR placement<br/>[ar.js]"]
  node_ar_reticle["AR reticle<br/>[ar-reticle.js]"]
  node_ar_hint["AR guidance<br/>[ar-hint.js]"]
  node_webxr["WebXR runtime"]
end

node_guest(("Guest"))

node_guest -->|"opens app"| node_bootstrap
node_bootstrap -->|"creates"| node_renderer
node_bootstrap -->|"creates"| node_scene
node_renderer -->|"shows failure"| node_webgpu_gate
node_bootstrap -->|"registers worker"| node_pwa
node_bootstrap -.->|"assembles world"| node_world_builders
node_world_builders -->|"uses layout"| node_world_plan
node_world_builders -.->|"builds walkable areas"| node_walkable
node_guest -->|"operates"| node_controls
node_controls -->|"enables walking"| node_first_person
node_first_person -->|"steps walker"| node_walk_math
node_first_person -->|"updates motion"| node_view_motion
node_guest -->|"points at table"| node_pointer
node_bootstrap -->|"enables selection"| node_pointer
node_pointer -->|"dispatches ray"| node_selection
node_selection -->|"opens details"| node_table_card
node_bootstrap -->|"creates service"| node_selection
node_bootstrap -->|"creates highlighter"| node_highlight
node_guest -->|"sets criteria"| node_preferences
node_preferences -->|"ranks tables"| node_recommend
node_guest -->|"confirms reservation"| node_table_card
node_table_card -->|"renders menu"| node_menu_list
node_menu_list -->|"reads catalogue"| node_menu_data
node_bootstrap -->|"fans out status"| node_status
node_guest -->|"enters VR"| node_vr
node_bootstrap -->|"sets up AR"| node_ar
node_ar -->|"creates reticle"| node_ar_reticle
node_ar -->|"creates guidance"| node_ar_hint
node_vr -->|"opens session"| node_webxr
node_ar -->|"requests AR session"| node_webxr

click node_bootstrap "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/main.js"
click node_renderer "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/core/renderer.js"
click node_scene "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/core/scene.js"
click node_webgpu_gate "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/webgpu-gate.js"
click node_pwa "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/core/pwa.js"
click node_world_plan "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/world/layout.js"
click node_world_builders "https://github.com/slim40-jpg/restaurant-xr/tree/main/src/world"
click node_walkable "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/world/walkable.js"
click node_controls "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/controls.js"
click node_first_person "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/first-person.js"
click node_walk_math "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/walk-math.js"
click node_view_motion "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/view-motion.js"
click node_pointer "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/pointer.js"
click node_selection "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/selection.js"
click node_highlight "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/highlight.js"
click node_preferences "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/preferences.js"
click node_recommend "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/recommend.js"
click node_table_card "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/table-card.js"
click node_menu_list "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/menu-list.js"
click node_menu_data "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/config/menu.js"
click node_status "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/status-fanout.js"
click node_vr "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/controllers.js"
click node_ar "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/ar.js"
click node_ar_reticle "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/ar-reticle.js"
click node_ar_hint "https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/ar-hint.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_controls,node_first_person,node_walk_math,node_view_motion,node_menu_list,node_menu_data,node_status toneBlue
class node_pointer,node_selection,node_highlight,node_preferences,node_recommend,node_table_card toneAmber
class node_world_plan,node_world_builders,node_walkable toneMint
class node_bootstrap,node_renderer,node_scene,node_webgpu_gate,node_pwa toneRose
class node_vr,node_ar,node_ar_reticle,node_ar_hint,node_webxr,node_guest toneIndigo
```

## Components

### Guest experience

- [Orbit and walk controls](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/controls.js): `src/interaction/controls.js`
- [First-person movement](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/first-person.js): `src/interaction/first-person.js`
- [Collision movement](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/walk-math.js): `src/interaction/walk-math.js`
- [Walking motion](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/view-motion.js): `src/interaction/view-motion.js`
- [Restaurant menu](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/menu-list.js): `src/ui/menu-list.js`
- [Menu catalogue](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/config/menu.js): `src/config/menu.js`
- [Status displays](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/status-fanout.js): `src/ui/status-fanout.js`

### Table discovery

- [Pointer selection](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/pointer.js): `src/interaction/pointer.js`
- [Table selection](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/selection.js): `src/interaction/selection.js`
- [Table highlighting](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/highlight.js): `src/interaction/highlight.js`
- [Preference controls](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/preferences.js): `src/ui/preferences.js`
- [Table recommendation](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/interaction/recommend.js): `src/interaction/recommend.js`
- [Table details and reserve](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/table-card.js): `src/ui/table-card.js`

### Restaurant world

- [Room and table plan](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/world/layout.js): `src/world/layout.js`
- [Restaurant reconstruction](https://github.com/slim40-jpg/restaurant-xr/tree/main/src/world): `src/world`
- [Walkable surfaces](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/world/walkable.js): `src/world/walkable.js`

### Rendering and runtime

- [App bootstrap](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/main.js): `src/main.js`
- [WebGPU renderer](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/core/renderer.js): `src/core/renderer.js`
- [Scene and lighting](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/core/scene.js): `src/core/scene.js`
- [WebGPU gate](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/ui/webgpu-gate.js): `src/ui/webgpu-gate.js`
- [Offline install](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/core/pwa.js): `src/core/pwa.js`

### XR modes

- [VR controllers](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/controllers.js): `src/xr/controllers.js`
- [AR placement](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/ar.js): `src/xr/ar.js`
- [AR reticle](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/ar-reticle.js): `src/xr/ar-reticle.js`
- [AR guidance](https://github.com/slim40-jpg/restaurant-xr/blob/main/src/xr/ar-hint.js): `src/xr/ar-hint.js`
- **WebXR runtime**

### Other components

- **Guest**

## Connections

- Guest → App bootstrap: opens app
- App bootstrap → WebGPU renderer: creates (evidence: `src/main.js`)
- App bootstrap → Scene and lighting: creates (evidence: `src/main.js`)
- WebGPU renderer → WebGPU gate: shows failure (evidence: `src/core/renderer.js`)
- App bootstrap → Offline install: registers worker (evidence: `src/main.js`)
- App bootstrap → Restaurant reconstruction: assembles world (evidence: `src/main.js`)
- Restaurant reconstruction → Room and table plan: uses layout (evidence: `src/world/architecture.js`)
- Restaurant reconstruction → Walkable surfaces: builds walkable areas
- Guest → Orbit and walk controls: operates
- Orbit and walk controls → First-person movement: enables walking
- First-person movement → Collision movement: steps walker (evidence: `src/interaction/first-person.js`)
- First-person movement → Walking motion: updates motion (evidence: `src/interaction/first-person.js`)
- Guest → Pointer selection: points at table
- App bootstrap → Pointer selection: enables selection (evidence: `src/main.js`)
- Pointer selection → Table selection: dispatches ray (evidence: `src/main.js`)
- Table selection → Table details and reserve: opens details (evidence: `src/main.js`)
- App bootstrap → Table selection: creates service (evidence: `src/main.js`)
- App bootstrap → Table highlighting: creates highlighter (evidence: `src/main.js`)
- Guest → Preference controls: sets criteria
- Preference controls → Table recommendation: ranks tables (evidence: `src/ui/preferences.js`)
- Guest → Table details and reserve: confirms reservation
- Table details and reserve → Restaurant menu: renders menu (evidence: `src/ui/table-card.js`)
- Restaurant menu → Menu catalogue: reads catalogue (evidence: `src/ui/menu-list.js`)
- App bootstrap → Status displays: fans out status (evidence: `src/main.js`)
- Guest → VR controllers: enters VR
- App bootstrap → AR placement: sets up AR (evidence: `src/main.js`)
- AR placement → AR reticle: creates reticle (evidence: `src/xr/ar.js`)
- AR placement → AR guidance: creates guidance (evidence: `src/xr/ar.js`)
- VR controllers → WebXR runtime: opens session (evidence: `src/xr/controllers.js`)
- AR placement → WebXR runtime: requests AR session (evidence: `src/xr/ar.js`)
