# ashtonwooster/solp architecture

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

- Interactive diagram: https://gitdiagram.com/ashtonwooster/solp
- Repository: https://github.com/ashtonwooster/solp

## Overview

SoLP is a browser-based digital table for the LoR PMTTRPG. Members create or join persistent games, build character sheets and equipment, then the GM hosts live play; board and player devices connect directly to the GM over WebRTC, while Firestore supports accounts, game data, discovery and autosaves. The graph covers character/rules, tabletop management, live play, maps and effects, plus Firebase services and game lifecycle functions. Several UI capabilities are documented but their implementation was not sampled, so only documented links are shown.

Main entry points: [`shared/engine.ts`](https://github.com/ashtonwooster/solp/blob/main/shared/engine.ts) (Action engine), [`src/components/creator/CharacterCreator.tsx`](https://github.com/ashtonwooster/solp/blob/main/src/components/creator/CharacterCreator.tsx) (Character creator), [`src/screens/Gm.tsx`](https://github.com/ashtonwooster/solp/blob/main/src/screens/Gm.tsx) (GM controls), [`src/net/host.ts`](https://github.com/ashtonwooster/solp/blob/main/src/net/host.ts) (GM session host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["App routing<br/>[main.tsx]"]
  node_auth["Authentication<br/>[Auth.tsx]"]
  node_gamepages["Game screens<br/>[GamePage.tsx]"]
  node_creator["Character creator"]
  node_sheets["Character sheets<br/>[character.ts]"]
  node_gm["GM controls<br/>[Gm.tsx]"]
  node_player["Player view<br/>[Play.tsx]"]
  node_board["Shared board<br/>[Board.tsx]"]
end

subgraph group_domain["Game domain"]
  node_formulas["Stat formulas<br/>[formulas.ts]"]
  node_rules["Ruleset data<br/>[ruleset.ts]"]
  node_engine["Action engine<br/>[engine.ts]"]
  node_combat["Combat rules<br/>[combat.ts]"]
end

subgraph group_live["Live tabletop"]
  node_host["GM session host<br/>[host.ts]"]
  node_client["Device client<br/>[client.ts]"]
  node_rtc["WebRTC transport<br/>[rtc.ts]"]
end

subgraph group_content["Maps and effects"]
  node_maps["Map management<br/>[MapEditor.tsx]"]
  node_maplogic["Map and fog logic<br/>[maps.ts]"]
  node_effects["Effect rules<br/>[effects.ts]"]
  node_effectui["Effect library<br/>[library.tsx]"]
  node_popups["Player popups<br/>[popups.ts]"]
end

subgraph group_backend["Firebase backend"]
  node_api["Firestore hooks<br/>[api.ts]"]
  node_firebase["Firebase services<br/>[firebase.ts]"]
  node_firestore[("Firestore")]
  node_storage[("Cloud Storage")]
  node_functions["Game lifecycle functions<br/>[index.ts]"]
  node_deletegame["Delete game operation<br/>[deleteGame.ts]"]
end

node_member(("Game members"))

node_member -->|"opens"| node_webapp
node_webapp -->|"routes to"| node_auth
node_webapp -->|"routes to"| node_gamepages
node_member -->|"creates character"| node_creator
node_creator -->|"edits"| node_sheets
node_creator -->|"calculates stats"| node_formulas
node_creator -->|"uses rules"| node_rules
node_gm -.->|"submits actions"| node_engine
node_player -->|"requests actions"| node_engine
node_engine -->|"uses combat rules"| node_combat
node_engine -->|"uses rules"| node_rules
node_engine -->|"reads character data"| node_sheets
node_gm -.->|"starts hosting"| node_host
node_player -->|"connects"| node_client
node_board -.->|"connects"| node_client
node_client -->|"uses transport"| node_rtc
node_host -->|"uses transport"| node_rtc
node_host -->|"applies actions"| node_engine
node_host -->|"autosaves and discovers"| node_firestore
node_gm -->|"edits maps"| node_maps
node_maps -->|"uses map logic"| node_maplogic
node_effectui -->|"edits definitions"| node_effects
node_engine -->|"runs triggers"| node_effects
node_gm -.->|"sends popups"| node_popups
node_api -->|"subscribes"| node_firestore
node_firebase -->|"initializes"| node_firestore
node_firebase -->|"initializes"| node_storage
node_member -.->|"creates or joins games"| node_functions
node_functions -->|"dispatches deletion"| node_deletegame
node_deletegame -.->|"deletes game data"| node_firestore
node_creator -->|"uploads portraits"| node_storage

click node_webapp "https://github.com/ashtonwooster/solp/blob/main/src/main.tsx"
click node_auth "https://github.com/ashtonwooster/solp/blob/main/src/screens/Auth.tsx"
click node_gamepages "https://github.com/ashtonwooster/solp/blob/main/src/screens/GamePage.tsx"
click node_creator "https://github.com/ashtonwooster/solp/blob/main/src/components/creator/CharacterCreator.tsx"
click node_sheets "https://github.com/ashtonwooster/solp/blob/main/shared/character.ts"
click node_formulas "https://github.com/ashtonwooster/solp/blob/main/shared/formulas.ts"
click node_rules "https://github.com/ashtonwooster/solp/blob/main/shared/ruleset.ts"
click node_engine "https://github.com/ashtonwooster/solp/blob/main/shared/engine.ts"
click node_combat "https://github.com/ashtonwooster/solp/blob/main/shared/combat.ts"
click node_gm "https://github.com/ashtonwooster/solp/blob/main/src/screens/Gm.tsx"
click node_player "https://github.com/ashtonwooster/solp/blob/main/src/screens/Play.tsx"
click node_board "https://github.com/ashtonwooster/solp/blob/main/src/screens/Board.tsx"
click node_host "https://github.com/ashtonwooster/solp/blob/main/src/net/host.ts"
click node_client "https://github.com/ashtonwooster/solp/blob/main/src/net/client.ts"
click node_rtc "https://github.com/ashtonwooster/solp/blob/main/src/net/rtc.ts"
click node_maps "https://github.com/ashtonwooster/solp/blob/main/src/components/maps/MapEditor.tsx"
click node_maplogic "https://github.com/ashtonwooster/solp/blob/main/shared/maps.ts"
click node_effects "https://github.com/ashtonwooster/solp/blob/main/shared/effects.ts"
click node_effectui "https://github.com/ashtonwooster/solp/blob/main/src/components/effects/library.tsx"
click node_popups "https://github.com/ashtonwooster/solp/blob/main/shared/popups.ts"
click node_api "https://github.com/ashtonwooster/solp/blob/main/src/api.ts"
click node_firebase "https://github.com/ashtonwooster/solp/blob/main/src/firebase.ts"
click node_functions "https://github.com/ashtonwooster/solp/blob/main/functions/src/index.ts"
click node_deletegame "https://github.com/ashtonwooster/solp/blob/main/functions/src/deleteGame.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_webapp,node_auth,node_gamepages,node_creator,node_sheets,node_gm,node_player,node_board toneBlue
class node_formulas,node_rules,node_engine,node_combat toneAmber
class node_host,node_client,node_rtc toneMint
class node_maps,node_maplogic,node_effects,node_effectui,node_popups toneRose
class node_api,node_firebase,node_firestore,node_storage,node_functions,node_deletegame,node_member toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/ashtonwooster/solp/blob/main/src/main.tsx): `src/main.tsx`
- [Authentication](https://github.com/ashtonwooster/solp/blob/main/src/screens/Auth.tsx): `src/screens/Auth.tsx`
- [Game screens](https://github.com/ashtonwooster/solp/blob/main/src/screens/GamePage.tsx): `src/screens/GamePage.tsx`
- [Character creator](https://github.com/ashtonwooster/solp/blob/main/src/components/creator/CharacterCreator.tsx): `src/components/creator/CharacterCreator.tsx`
- [Character sheets](https://github.com/ashtonwooster/solp/blob/main/shared/character.ts): `shared/character.ts`
- [GM controls](https://github.com/ashtonwooster/solp/blob/main/src/screens/Gm.tsx): `src/screens/Gm.tsx`
- [Player view](https://github.com/ashtonwooster/solp/blob/main/src/screens/Play.tsx): `src/screens/Play.tsx`
- [Shared board](https://github.com/ashtonwooster/solp/blob/main/src/screens/Board.tsx): `src/screens/Board.tsx`

### Game domain

- [Stat formulas](https://github.com/ashtonwooster/solp/blob/main/shared/formulas.ts): `shared/formulas.ts`
- [Ruleset data](https://github.com/ashtonwooster/solp/blob/main/shared/ruleset.ts): `shared/ruleset.ts`
- [Action engine](https://github.com/ashtonwooster/solp/blob/main/shared/engine.ts): `shared/engine.ts`
- [Combat rules](https://github.com/ashtonwooster/solp/blob/main/shared/combat.ts): `shared/combat.ts`

### Live tabletop

- [GM session host](https://github.com/ashtonwooster/solp/blob/main/src/net/host.ts): `src/net/host.ts`
- [Device client](https://github.com/ashtonwooster/solp/blob/main/src/net/client.ts): `src/net/client.ts`
- [WebRTC transport](https://github.com/ashtonwooster/solp/blob/main/src/net/rtc.ts): `src/net/rtc.ts`

### Maps and effects

- [Map management](https://github.com/ashtonwooster/solp/blob/main/src/components/maps/MapEditor.tsx): `src/components/maps/MapEditor.tsx`
- [Map and fog logic](https://github.com/ashtonwooster/solp/blob/main/shared/maps.ts): `shared/maps.ts`
- [Effect rules](https://github.com/ashtonwooster/solp/blob/main/shared/effects.ts): `shared/effects.ts`
- [Effect library](https://github.com/ashtonwooster/solp/blob/main/src/components/effects/library.tsx): `src/components/effects/library.tsx`
- [Player popups](https://github.com/ashtonwooster/solp/blob/main/shared/popups.ts): `shared/popups.ts`

### Firebase backend

- [Firestore hooks](https://github.com/ashtonwooster/solp/blob/main/src/api.ts): `src/api.ts`
- [Firebase services](https://github.com/ashtonwooster/solp/blob/main/src/firebase.ts): `src/firebase.ts`
- **Firestore**
- **Cloud Storage**
- [Game lifecycle functions](https://github.com/ashtonwooster/solp/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Delete game operation](https://github.com/ashtonwooster/solp/blob/main/functions/src/deleteGame.ts): `functions/src/deleteGame.ts`

### Other components

- **Game members**

## Connections

- Game members → App routing: opens (evidence: `src/main.tsx`)
- App routing → Authentication: routes to (evidence: `src/main.tsx`)
- App routing → Game screens: routes to (evidence: `src/main.tsx`)
- Game members → Character creator: creates character
- Character creator → Character sheets: edits (evidence: `src/components/creator/CharacterCreator.tsx`)
- Character creator → Stat formulas: calculates stats (evidence: `src/components/creator/CharacterCreator.tsx`)
- Character creator → Ruleset data: uses rules (evidence: `src/components/creator/CharacterCreator.tsx`)
- GM controls → Action engine: submits actions
- Player view → Action engine: requests actions (evidence: `src/screens/Play.tsx`)
- Action engine → Combat rules: uses combat rules (evidence: `shared/engine.ts`)
- Action engine → Ruleset data: uses rules (evidence: `shared/engine.ts`)
- Action engine → Character sheets: reads character data (evidence: `shared/engine.ts`)
- GM controls → GM session host: starts hosting
- Player view → Device client: connects (evidence: `src/net/client.ts`)
- Shared board → Device client: connects
- Device client → WebRTC transport: uses transport (evidence: `src/net/client.ts`)
- GM session host → WebRTC transport: uses transport (evidence: `src/net/host.ts`)
- GM session host → Action engine: applies actions (evidence: `shared/engine.ts`)
- GM session host → Firestore: autosaves and discovers (evidence: `src/net/host.ts`)
- GM controls → Map management: edits maps (evidence: `src/components/maps/MapEditor.tsx`)
- Map management → Map and fog logic: uses map logic (evidence: `src/components/maps/MapEditor.tsx`)
- Effect library → Effect rules: edits definitions (evidence: `src/components/effects/library.tsx`)
- Action engine → Effect rules: runs triggers (evidence: `shared/effects.ts`)
- GM controls → Player popups: sends popups
- Firestore hooks → Firestore: subscribes (evidence: `src/api.ts`)
- Firebase services → Firestore: initializes (evidence: `src/firebase.ts`)
- Firebase services → Cloud Storage: initializes (evidence: `src/firebase.ts`)
- Game members → Game lifecycle functions: creates or joins games
- Game lifecycle functions → Delete game operation: dispatches deletion (evidence: `functions/src/index.ts`)
- Delete game operation → Firestore: deletes game data
- Character creator → Cloud Storage: uploads portraits
