# oddvar112/02162-software-engineering-2-fall-2026 architecture

> Architecture diagram of the GitHub repository oddvar112/02162-software-engineering-2-fall-2026, 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/oddvar112/02162-software-engineering-2-fall-2026
- Repository: https://github.com/oddvar112/02162-software-engineering-2-fall-2026

## Overview

RoboRally is a Next.js browser game with Supabase-backed authentication and lobby browsing, plus a separate in-memory programming-phase demo. The demo workflow is: open the board, fetch shared state, choose and submit a five-card program, resolve movement, then display and replay execution frames. The graph preserves the documented lobby and authentication branches and separates game rules from the board renderer. The demo engine and major UI calls are shown in excerpts or the source index; unsampled lobby and integration details are kept limited to documented or indexed relationships.

Main entry points: [`lib/supabase/server.ts`](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/supabase/server.ts) (Supabase clients), [`app/page.tsx`](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/page.tsx) (Home page), [`components/game/game-state-view.tsx`](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/game-state-view.tsx) (Game state view), [`components/lobbies/list-lobbies.tsx`](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/list-lobbies.tsx) (Lobby listing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_home["Home page<br/>[page.tsx]"]
  node_lobby_list_page["Lobby browse page<br/>[page.tsx]"]
  node_lobby_room_page["Lobby room page<br/>[page.tsx]"]
  node_game_demo_page["Demo game page<br/>[page.tsx]"]
  node_game_page["Match page<br/>[page.tsx]"]
end

subgraph group_identity["Identity"]
  node_auth_pages["Auth pages<br/>[page.tsx]"]
  node_auth_forms["Auth forms<br/>[login-form.tsx]"]
  node_auth_button["Session controls<br/>[auth-button.tsx]"]
  node_auth_confirm["Auth confirmation<br/>[route.ts]"]
  node_route_rules["Route rules<br/>[routes.ts]"]
end

subgraph group_lobby["Lobby experience"]
  node_lobby_browse["Lobby listing<br/>[list-lobbies.tsx]"]
  node_lobby_create["Create lobby"]
  node_lobby_membership["Lobby membership"]
  node_lobby_room["Lobby room view<br/>[lobby-content.tsx]"]
  node_lobby_sync["Lobby realtime<br/>[lobby-realtime.tsx]"]
end

subgraph group_gameplay["Demo gameplay"]
  node_game_view["Game state view"]
  node_game_api["Game state API<br/>[route.ts]"]
  node_program_editor["Program editor<br/>[program-editor.tsx]"]
  node_playback["Playback hook"]
  node_board_renderer["3D board renderer<br/>[game-board.tsx]"]
  node_robot_model["Robot model<br/>[robot-model.tsx]"]
  node_game_rules["Program resolution<br/>[programming.ts]"]
  node_mock_state["Mock game state<br/>[mock-game-state.ts]"]
  node_board_model["Board model<br/>[game-model.ts]"]
  node_board_types["Board validation<br/>[board.ts]"]
end

subgraph group_platform["Shared platform"]
  node_supabase_clients["Supabase clients<br/>[server.ts]"]
  node_supabase_browser["Browser client<br/>[client.ts]"]
  node_supabase[("Supabase")]
end

node_player(("Player"))

node_player -->|"opens"| node_home
node_home -->|"offers creation"| node_lobby_create
node_home -->|"links to browse"| node_lobby_list_page
node_home -->|"links to demo"| node_game_demo_page
node_home -->|"shows session"| node_auth_button
node_player -->|"signs in"| node_auth_pages
node_auth_pages -->|"renders"| node_auth_forms
node_auth_forms -->|"authenticates"| node_supabase_browser
node_auth_button -->|"checks claims"| node_supabase_clients
node_auth_confirm -->|"confirms session"| node_supabase_clients
node_auth_confirm -->|"uses return paths"| node_route_rules
node_player -->|"browses"| node_lobby_list_page
node_lobby_list_page -->|"renders"| node_lobby_browse
node_lobby_browse -->|"reads lobbies"| node_supabase_clients
node_lobby_browse -->|"offers leave"| node_lobby_membership
node_lobby_browse -.->|"joins room"| node_lobby_room_page
node_lobby_room_page -->|"renders"| node_lobby_room
node_lobby_room -->|"reads room"| node_supabase_clients
node_lobby_room -->|"offers leave"| node_lobby_membership
node_lobby_room -->|"uses updates"| node_lobby_sync
node_lobby_create -->|"creates lobby"| node_supabase_browser
node_game_demo_page -->|"renders"| node_game_view
node_game_view -->|"fetches state"| node_game_api
node_game_view -->|"renders"| node_program_editor
node_game_view -->|"uses playback"| node_playback
node_game_view -->|"renders board"| node_board_renderer
node_game_api -->|"submits programs"| node_game_rules
node_game_api -->|"loads model"| node_board_model
node_game_rules -->|"creates state"| node_mock_state
node_mock_state -->|"builds from"| node_board_model
node_mock_state -->|"uses board data"| node_board_types
node_board_renderer -->|"renders robots"| node_robot_model
node_player -->|"opens match"| node_game_page
node_game_page -->|"checks server session"| node_supabase_clients
node_supabase_clients -->|"connects"| node_supabase
node_supabase_browser -->|"connects"| node_supabase

click node_home "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/page.tsx"
click node_lobby_list_page "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/lobbies/page.tsx"
click node_lobby_room_page "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/lobbies/%5BlobbyId%5D/page.tsx"
click node_game_demo_page "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/game/page.tsx"
click node_game_page "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/games/%5BgameId%5D/page.tsx"
click node_auth_pages "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/auth/login/page.tsx"
click node_auth_forms "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/auth/login-form.tsx"
click node_auth_button "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/auth/auth-button.tsx"
click node_auth_confirm "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/auth/confirm/route.ts"
click node_route_rules "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/routes.ts"
click node_lobby_browse "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/list-lobbies.tsx"
click node_lobby_create "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/create-lobby-button.tsx"
click node_lobby_membership "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/leave-lobby-button.tsx"
click node_lobby_room "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/lobby-content.tsx"
click node_lobby_sync "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/lobby-realtime.tsx"
click node_game_view "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/game-state-view.tsx"
click node_game_api "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/api/game-state/route.ts"
click node_program_editor "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/program-editor.tsx"
click node_playback "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/use-game-playback.ts"
click node_board_renderer "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/board/game-board.tsx"
click node_robot_model "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/board/robot-model.tsx"
click node_game_rules "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/game/programming.ts"
click node_mock_state "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/game/mock-game-state.ts"
click node_board_model "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/game/game-model.ts"
click node_board_types "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/board.ts"
click node_supabase_clients "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/supabase/server.ts"
click node_supabase_browser "https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/supabase/client.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_home,node_lobby_list_page,node_lobby_room_page,node_game_demo_page,node_game_page toneBlue
class node_auth_pages,node_auth_forms,node_auth_button,node_auth_confirm,node_route_rules toneAmber
class node_lobby_browse,node_lobby_create,node_lobby_membership,node_lobby_room,node_lobby_sync toneMint
class node_game_view,node_game_api,node_program_editor,node_playback,node_board_renderer,node_robot_model,node_game_rules,node_mock_state,node_board_model,node_board_types toneRose
class node_supabase_clients,node_supabase_browser,node_supabase,node_player toneIndigo
```

## Components

### App entry

- [Home page](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/page.tsx): `app/page.tsx`
- [Lobby browse page](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/lobbies/page.tsx): `app/lobbies/page.tsx`
- [Lobby room page](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/lobbies/%5BlobbyId%5D/page.tsx): `app/lobbies/[lobbyId]/page.tsx`
- [Demo game page](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/game/page.tsx): `app/game/page.tsx`
- [Match page](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/games/%5BgameId%5D/page.tsx): `app/games/[gameId]/page.tsx`

### Identity

- [Auth pages](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/auth/login/page.tsx): `app/auth/login/page.tsx`
- [Auth forms](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/auth/login-form.tsx): `components/auth/login-form.tsx`
- [Session controls](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/auth/auth-button.tsx): `components/auth/auth-button.tsx`
- [Auth confirmation](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/auth/confirm/route.ts): `app/auth/confirm/route.ts`
- [Route rules](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/routes.ts): `lib/routes.ts`

### Lobby experience

- [Lobby listing](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/list-lobbies.tsx): `components/lobbies/list-lobbies.tsx`
- [Create lobby](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/create-lobby-button.tsx): `components/lobbies/create-lobby-button.tsx`
- [Lobby membership](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/leave-lobby-button.tsx): `components/lobbies/leave-lobby-button.tsx`
- [Lobby room view](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/lobby-content.tsx): `components/lobbies/lobby-content.tsx`
- [Lobby realtime](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/lobbies/lobby-realtime.tsx): `components/lobbies/lobby-realtime.tsx`

### Demo gameplay

- [Game state view](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/game-state-view.tsx): `components/game/game-state-view.tsx`
- [Game state API](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/app/api/game-state/route.ts): `app/api/game-state/route.ts`
- [Program editor](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/program-editor.tsx): `components/game/program-editor.tsx`
- [Playback hook](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/use-game-playback.ts): `components/game/use-game-playback.ts`
- [3D board renderer](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/board/game-board.tsx): `components/game/board/game-board.tsx`
- [Robot model](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/components/game/board/robot-model.tsx): `components/game/board/robot-model.tsx`
- [Program resolution](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/game/programming.ts): `lib/game/programming.ts`
- [Mock game state](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/game/mock-game-state.ts): `lib/game/mock-game-state.ts`
- [Board model](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/game/game-model.ts): `lib/game/game-model.ts`
- [Board validation](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/board.ts): `lib/board.ts`

### Shared platform

- [Supabase clients](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Browser client](https://github.com/oddvar112/02162-software-engineering-2-fall-2026/blob/main/lib/supabase/client.ts): `lib/supabase/client.ts`
- **Supabase**

### Other components

- **Player**

## Connections

- Player → Home page: opens (evidence: `app/page.tsx`)
- Home page → Create lobby: offers creation (evidence: `app/page.tsx`)
- Home page → Lobby browse page: links to browse (evidence: `app/page.tsx`)
- Home page → Demo game page: links to demo (evidence: `app/page.tsx`)
- Home page → Session controls: shows session (evidence: `app/page.tsx`)
- Player → Auth pages: signs in (evidence: `app/auth/login/page.tsx`)
- Auth pages → Auth forms: renders (evidence: `app/auth/login/page.tsx`)
- Auth forms → Browser client: authenticates (evidence: `components/auth/login-form.tsx`)
- Session controls → Supabase clients: checks claims (evidence: `components/auth/auth-button.tsx`)
- Auth confirmation → Supabase clients: confirms session (evidence: `app/auth/confirm/route.ts`)
- Auth confirmation → Route rules: uses return paths (evidence: `app/auth/confirm/route.ts`)
- Player → Lobby browse page: browses (evidence: `app/lobbies/page.tsx`)
- Lobby browse page → Lobby listing: renders (evidence: `app/lobbies/page.tsx`)
- Lobby listing → Supabase clients: reads lobbies (evidence: `components/lobbies/list-lobbies.tsx`)
- Lobby listing → Lobby membership: offers leave (evidence: `components/lobbies/list-lobbies.tsx`)
- Lobby listing → Lobby room page: joins room
- Lobby room page → Lobby room view: renders (evidence: `app/lobbies/[lobbyId]/page.tsx`)
- Lobby room view → Supabase clients: reads room (evidence: `components/lobbies/lobby-content.tsx`)
- Lobby room view → Lobby membership: offers leave (evidence: `components/lobbies/lobby-content.tsx`)
- Lobby room view → Lobby realtime: uses updates (evidence: `components/lobbies/lobby-content.tsx`)
- Create lobby → Browser client: creates lobby (evidence: `components/lobbies/create-lobby-button.tsx`)
- Demo game page → Game state view: renders (evidence: `app/game/page.tsx`)
- Game state view → Game state API: fetches state (evidence: `components/game/game-state-view.tsx`)
- Game state view → Program editor: renders (evidence: `components/game/game-state-view.tsx`)
- Game state view → Playback hook: uses playback (evidence: `components/game/game-state-view.tsx`)
- Game state view → 3D board renderer: renders board (evidence: `components/game/game-state-view.tsx`)
- Game state API → Program resolution: submits programs (evidence: `app/api/game-state/route.ts`)
- Game state API → Board model: loads model (evidence: `app/api/game-state/route.ts`)
- Program resolution → Mock game state: creates state (evidence: `lib/game/programming.ts`)
- Mock game state → Board model: builds from (evidence: `lib/game/mock-game-state.ts`)
- Mock game state → Board validation: uses board data (evidence: `lib/game/mock-game-state.ts`)
- 3D board renderer → Robot model: renders robots (evidence: `components/game/board/game-board.tsx`)
- Player → Match page: opens match (evidence: `app/games/[gameId]/page.tsx`)
- Match page → Supabase clients: checks server session
- Supabase clients → Supabase: connects (evidence: `lib/supabase/server.ts`)
- Browser client → Supabase: connects (evidence: `lib/supabase/client.ts`)
