# kruetztopf/scotlandyard architecture

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

- Interactive diagram: https://gitdiagram.com/kruetztopf/scotlandyard
- Repository: https://github.com/kruetztopf/scotlandyard

## Overview

This is a mobile Scotland Yard–style location game. Players create or join a lobby, configure a play boundary, and enter a live map game with location tracking, robber sightings, chat, and catch voting. The sampled app entry point confirms the lobby-to-game transition; screen excerpts and the source index show the main feature components and their dependencies. The README is empty, and several feature files were not excerpted, so those branches are limited to relationships supported by the source index.

Main entry points: [`src/screens/MapScreen.tsx`](https://github.com/kruetztopf/scotlandyard/blob/master/src/screens/MapScreen.tsx) (Live game screen), [`src/screens/LobbyScreen.tsx`](https://github.com/kruetztopf/scotlandyard/blob/master/src/screens/LobbyScreen.tsx) (Lobby screen), [`src/lib/supabase.ts`](https://github.com/kruetztopf/scotlandyard/blob/master/src/lib/supabase.ts) (Supabase client), [`App.tsx`](https://github.com/kruetztopf/scotlandyard/blob/master/App.tsx) (App router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App flow"]
  node_app["App router<br/>[App.tsx]"]
end

subgraph group_lobby["Lobby and setup"]
  node_lobby["Lobby screen<br/>[LobbyScreen.tsx]"]
  node_boundary["Boundary setup"]
  node_lobby_menu["Lobby game menu<br/>[GameMenuModal.tsx]"]
  node_profile_modal["Profile editor<br/>[ProfileModal.tsx]"]
end

subgraph group_gameplay["Live gameplay"]
  node_map_screen["Live game screen<br/>[MapScreen.tsx]"]
  node_map_view["Live map<br/>[OSMMapView.tsx]"]
  node_camera_catch["Photo catch"]
  node_catch_vote["Catch voting<br/>[CatchVoteModal.tsx]"]
  node_chat["Game chat<br/>[ChatModal.tsx]"]
  node_game_menu["In-game menu<br/>[GameMenuModal.tsx]"]
  node_instructions["Instructions"]
end

subgraph group_support["Shared services"]
  node_game_types["Game data types<br/>[game.ts]"]
  node_geo["Geo utilities<br/>[geo.ts]"]
  node_profile["Local profile<br/>[profile.ts]"]
  node_recent["Recent lobbies<br/>[recentLobbies.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
end

node_player(("Player"))
node_supabase[("Supabase backend")]
node_device(("Device location"))
node_osm(("OpenStreetMap tiles"))
node_os_notifications(("OS notifications"))

node_player -->|"uses"| node_app
node_app -->|"shows lobby"| node_lobby
node_app -->|"shows game"| node_map_screen
node_lobby -->|"starts game"| node_app
node_lobby -->|"opens setup"| node_boundary
node_lobby -->|"renders menu"| node_lobby_menu
node_lobby -->|"opens profile"| node_profile_modal
node_lobby -->|"uses backend"| node_supabase_client
node_lobby -->|"saves recent games"| node_recent
node_lobby -->|"loads profile"| node_profile
node_boundary -->|"reads and writes"| node_supabase_client
node_profile_modal -->|"loads and saves"| node_profile
node_map_screen -->|"renders map"| node_map_view
node_map_screen -->|"renders catch"| node_camera_catch
node_map_screen -->|"renders voting"| node_catch_vote
node_map_screen -->|"renders chat"| node_chat
node_map_screen -->|"renders menu"| node_game_menu
node_map_screen -->|"renders instructions"| node_instructions
node_map_screen -->|"checks game geometry"| node_geo
node_map_screen -->|"loads profile"| node_profile
node_map_screen -->|"sends chat alerts"| node_notifications
node_map_screen -->|"uses backend"| node_supabase_client
node_map_view -->|"formats map data"| node_geo
node_map_view -->|"loads map tiles"| node_osm
node_camera_catch -->|"uses backend"| node_supabase_client
node_catch_vote -->|"uses backend"| node_supabase_client
node_chat -->|"uses backend"| node_supabase_client
node_supabase_client -->|"connects to"| node_supabase
node_notifications -->|"schedules alerts"| node_os_notifications
node_app -->|"uses game data"| node_game_types
node_lobby -->|"uses game data"| node_game_types
node_map_screen -->|"uses game data"| node_game_types

click node_app "https://github.com/kruetztopf/scotlandyard/blob/master/App.tsx"
click node_lobby "https://github.com/kruetztopf/scotlandyard/blob/master/src/screens/LobbyScreen.tsx"
click node_boundary "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/BoundarySetupModal.tsx"
click node_lobby_menu "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/GameMenuModal.tsx"
click node_profile_modal "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/ProfileModal.tsx"
click node_map_screen "https://github.com/kruetztopf/scotlandyard/blob/master/src/screens/MapScreen.tsx"
click node_map_view "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/OSMMapView.tsx"
click node_camera_catch "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/CameraCatchModal.tsx"
click node_catch_vote "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/CatchVoteModal.tsx"
click node_chat "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/ChatModal.tsx"
click node_game_menu "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/GameMenuModal.tsx"
click node_instructions "https://github.com/kruetztopf/scotlandyard/blob/master/src/components/InstructionModal.tsx"
click node_game_types "https://github.com/kruetztopf/scotlandyard/blob/master/src/types/game.ts"
click node_geo "https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/geo.ts"
click node_profile "https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/profile.ts"
click node_recent "https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/recentLobbies.ts"
click node_notifications "https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/notifications.ts"
click node_supabase_client "https://github.com/kruetztopf/scotlandyard/blob/master/src/lib/supabase.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 toneBlue
class node_lobby,node_boundary,node_lobby_menu,node_profile_modal,node_supabase toneAmber
class node_map_screen,node_map_view,node_camera_catch,node_catch_vote,node_chat,node_game_menu,node_instructions toneMint
class node_game_types,node_geo,node_profile,node_recent,node_notifications,node_supabase_client toneRose
class node_player,node_device,node_osm,node_os_notifications toneIndigo
```

## Components

### App flow

- [App router](https://github.com/kruetztopf/scotlandyard/blob/master/App.tsx): `App.tsx`

### Lobby and setup

- [Lobby screen](https://github.com/kruetztopf/scotlandyard/blob/master/src/screens/LobbyScreen.tsx): `src/screens/LobbyScreen.tsx`
- [Boundary setup](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/BoundarySetupModal.tsx): `src/components/BoundarySetupModal.tsx`
- [Lobby game menu](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/GameMenuModal.tsx): `src/components/GameMenuModal.tsx`
- [Profile editor](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/ProfileModal.tsx): `src/components/ProfileModal.tsx`

### Live gameplay

- [Live game screen](https://github.com/kruetztopf/scotlandyard/blob/master/src/screens/MapScreen.tsx): `src/screens/MapScreen.tsx`
- [Live map](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/OSMMapView.tsx): `src/components/OSMMapView.tsx`
- [Photo catch](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/CameraCatchModal.tsx): `src/components/CameraCatchModal.tsx`
- [Catch voting](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/CatchVoteModal.tsx): `src/components/CatchVoteModal.tsx`
- [Game chat](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/ChatModal.tsx): `src/components/ChatModal.tsx`
- [In-game menu](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/GameMenuModal.tsx): `src/components/GameMenuModal.tsx`
- [Instructions](https://github.com/kruetztopf/scotlandyard/blob/master/src/components/InstructionModal.tsx): `src/components/InstructionModal.tsx`

### Shared services

- [Game data types](https://github.com/kruetztopf/scotlandyard/blob/master/src/types/game.ts): `src/types/game.ts`
- [Geo utilities](https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/geo.ts): `src/utils/geo.ts`
- [Local profile](https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/profile.ts): `src/utils/profile.ts`
- [Recent lobbies](https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/recentLobbies.ts): `src/utils/recentLobbies.ts`
- [Notifications](https://github.com/kruetztopf/scotlandyard/blob/master/src/utils/notifications.ts): `src/utils/notifications.ts`
- [Supabase client](https://github.com/kruetztopf/scotlandyard/blob/master/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Player**
- **Supabase backend**
- **Device location**
- **OpenStreetMap tiles**
- **OS notifications**

## Connections

- Player → App router: uses
- App router → Lobby screen: shows lobby (evidence: `App.tsx`)
- App router → Live game screen: shows game (evidence: `App.tsx`)
- Lobby screen → App router: starts game (evidence: `src/screens/LobbyScreen.tsx`)
- Lobby screen → Boundary setup: opens setup (evidence: `src/screens/LobbyScreen.tsx`)
- Lobby screen → Lobby game menu: renders menu (evidence: `src/screens/LobbyScreen.tsx`)
- Lobby screen → Profile editor: opens profile (evidence: `src/screens/LobbyScreen.tsx`)
- Lobby screen → Supabase client: uses backend (evidence: `src/screens/LobbyScreen.tsx`)
- Lobby screen → Recent lobbies: saves recent games (evidence: `src/screens/LobbyScreen.tsx`)
- Lobby screen → Local profile: loads profile (evidence: `src/screens/LobbyScreen.tsx`)
- Boundary setup → Supabase client: reads and writes (evidence: `src/components/BoundarySetupModal.tsx`)
- Profile editor → Local profile: loads and saves (evidence: `src/components/ProfileModal.tsx`)
- Live game screen → Live map: renders map (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Photo catch: renders catch (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Catch voting: renders voting (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Game chat: renders chat (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → In-game menu: renders menu (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Instructions: renders instructions (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Geo utilities: checks game geometry (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Local profile: loads profile (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Notifications: sends chat alerts (evidence: `src/screens/MapScreen.tsx`)
- Live game screen → Supabase client: uses backend (evidence: `src/screens/MapScreen.tsx`)
- Live map → Geo utilities: formats map data (evidence: `src/components/OSMMapView.tsx`)
- Live map → OpenStreetMap tiles: loads map tiles (evidence: `src/components/OSMMapView.tsx`)
- Photo catch → Supabase client: uses backend (evidence: `src/components/CameraCatchModal.tsx`)
- Catch voting → Supabase client: uses backend (evidence: `src/components/CatchVoteModal.tsx`)
- Game chat → Supabase client: uses backend (evidence: `src/components/ChatModal.tsx`)
- Supabase client → Supabase backend: connects to (evidence: `src/lib/supabase.ts`)
- Notifications → OS notifications: schedules alerts (evidence: `src/utils/notifications.ts`)
- App router → Game data types: uses game data (evidence: `App.tsx`)
- Lobby screen → Game data types: uses game data (evidence: `src/screens/LobbyScreen.tsx`)
- Live game screen → Game data types: uses game data (evidence: `src/screens/MapScreen.tsx`)
