# good665/warfrontmvp architecture

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

- Interactive diagram: https://gitdiagram.com/good665/warfrontmvp
- Repository: https://github.com/good665/warfrontmvp

## Overview

Warfront is a Unity mobile-game MVP with a FastAPI backend for accounts, combat settlement, online friend matches, and weekly training leagues. The principal flow is a player entering through the game client, authenticating and fetching account state, then playing a mode whose result is settled or scored by the relevant backend subsystem. The tree’s Unity scripts are explicitly described as an older local copy, so their connections to the active project are not assumed. Backend routes and services are only partly sampled; edges below use README statements or visible imports and calls.

Main entry points: [`backend/app/main.py`](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/main.py) (FastAPI App), [`backend/app/training_service.py`](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_service.py) (Training League Service), [`backend/app/database.py`](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/database.py) (Database Session), [`Assets/Scripts/GameBootstrap.cs`](https://github.com/good665/warfrontmvp/blob/feature/login/Assets/Scripts/GameBootstrap.cs) (Game Bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Unity Client Snapshot"]
  node_bootstrap["Game Bootstrap<br/>[GameBootstrap.cs]"]
  node_api_client["Game API Client<br/>[GameApiClient.cs]"]
  node_game_data["Local Game Data<br/>[GameData.cs]"]
end

subgraph group_api["Backend API"]
  node_api_app["FastAPI App<br/>[main.py]"]
  node_auth["JWT Security<br/>[security.py]"]
  node_experience_routes["Experience Routes"]
  node_experience["Tutorial and Telemetry<br/>[experience.py]"]
  node_arena_routes["Online Room Routes<br/>[online_routes.py]"]
  node_training_routes["Training Routes<br/>[training_routes.py]"]
end

subgraph group_combat["Combat Modes"]
  node_rooms["Room Matchmaking<br/>[online_rooms.py]"]
  node_arena["Online Arena<br/>[online_arena.py]"]
  node_game_rules["Game Rules<br/>[game_rules.py]"]
end

subgraph group_training["Weekly Training"]
  node_training_service["Training League Service"]
  node_replay["Replay Scoring<br/>[training_replay.py]"]
  node_seasons["Season Rules"]
  node_training_state[("Training Records<br/>[training_models.py]")]
end

subgraph group_state["Shared State"]
  node_experience_state[("Experience Records")]
  node_player_match_state[("Player and Match Records<br/>[models.py]")]
  node_database[("Database Session<br/>[database.py]")]
  node_config["Runtime Configuration<br/>[config.py]"]
end

node_player(("Player"))

node_player -->|"starts game"| node_bootstrap
node_bootstrap -.->|"uses client"| node_api_client
node_bootstrap -.->|"uses local data"| node_game_data
node_player -->|"uses server account"| node_api_app
node_api_app -->|"authenticates"| node_auth
node_api_app -->|"registers routes"| node_arena_routes
node_api_app -->|"registers routes"| node_experience_routes
node_api_app -->|"registers routes"| node_training_routes
node_arena_routes -->|"dispatches room actions"| node_rooms
node_rooms -->|"runs online combat"| node_arena
node_rooms -->|"uses rules"| node_game_rules
node_training_routes -->|"dispatches league actions"| node_training_service
node_training_service -->|"scores submissions"| node_replay
node_training_service -->|"uses season rules"| node_seasons
node_training_service -->|"reads and writes"| node_training_state
node_training_service -->|"uses game rules"| node_game_rules
node_experience_routes -->|"records events"| node_experience
node_experience_routes -->|"reads and writes"| node_experience_state
node_experience -->|"stores events"| node_experience_state
node_api_app -->|"uses account and match data"| node_player_match_state
node_api_app -->|"applies rules"| node_game_rules
node_player_match_state -->|"maps records"| node_database
node_experience_state -->|"maps records"| node_database
node_training_state -->|"maps records"| node_database
node_database -->|"loads connection settings"| node_config

click node_bootstrap "https://github.com/good665/warfrontmvp/blob/feature/login/Assets/Scripts/GameBootstrap.cs"
click node_api_client "https://github.com/good665/warfrontmvp/blob/feature/login/Assets/Scripts/GameApiClient.cs"
click node_game_data "https://github.com/good665/warfrontmvp/blob/feature/login/Assets/Scripts/GameData.cs"
click node_api_app "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/main.py"
click node_auth "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/security.py"
click node_experience_routes "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/experience_routes.py"
click node_experience "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/experience.py"
click node_arena_routes "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/online_routes.py"
click node_rooms "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/online_rooms.py"
click node_arena "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/online_arena.py"
click node_game_rules "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/game_rules.py"
click node_training_routes "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_routes.py"
click node_training_service "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_service.py"
click node_replay "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_replay.py"
click node_seasons "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_seasons.py"
click node_training_state "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_models.py"
click node_experience_state "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/experience_models.py"
click node_player_match_state "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/models.py"
click node_database "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/database.py"
click node_config "https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/config.py"

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_bootstrap,node_api_client,node_game_data toneBlue
class node_api_app,node_auth,node_experience_routes,node_experience,node_arena_routes,node_training_routes toneAmber
class node_rooms,node_arena,node_game_rules toneMint
class node_training_service,node_replay,node_seasons,node_training_state toneRose
class node_experience_state,node_player_match_state,node_database,node_config,node_player toneIndigo
```

## Components

### Unity Client Snapshot

- [Game Bootstrap](https://github.com/good665/warfrontmvp/blob/feature/login/Assets/Scripts/GameBootstrap.cs): `Assets/Scripts/GameBootstrap.cs`
- [Game API Client](https://github.com/good665/warfrontmvp/blob/feature/login/Assets/Scripts/GameApiClient.cs): `Assets/Scripts/GameApiClient.cs`
- [Local Game Data](https://github.com/good665/warfrontmvp/blob/feature/login/Assets/Scripts/GameData.cs): `Assets/Scripts/GameData.cs`

### Backend API

- [FastAPI App](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/main.py): `backend/app/main.py`
- [JWT Security](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/security.py): `backend/app/security.py`
- [Experience Routes](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/experience_routes.py): `backend/app/experience_routes.py`
- [Tutorial and Telemetry](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/experience.py): `backend/app/experience.py`
- [Online Room Routes](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/online_routes.py): `backend/app/online_routes.py`
- [Training Routes](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_routes.py): `backend/app/training_routes.py`

### Combat Modes

- [Room Matchmaking](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/online_rooms.py): `backend/app/online_rooms.py`
- [Online Arena](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/online_arena.py): `backend/app/online_arena.py`
- [Game Rules](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/game_rules.py): `backend/app/game_rules.py`

### Weekly Training

- [Training League Service](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_service.py): `backend/app/training_service.py`
- [Replay Scoring](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_replay.py): `backend/app/training_replay.py`
- [Season Rules](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_seasons.py): `backend/app/training_seasons.py`
- [Training Records](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/training_models.py): `backend/app/training_models.py`

### Shared State

- [Experience Records](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/experience_models.py): `backend/app/experience_models.py`
- [Player and Match Records](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/models.py): `backend/app/models.py`
- [Database Session](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/database.py): `backend/app/database.py`
- [Runtime Configuration](https://github.com/good665/warfrontmvp/blob/feature/login/backend/app/config.py): `backend/app/config.py`

### Other components

- **Player**

## Connections

- Player → Game Bootstrap: starts game (evidence: `README.md`)
- Game Bootstrap → Game API Client: uses client
- Game Bootstrap → Local Game Data: uses local data
- Player → FastAPI App: uses server account (evidence: `README.md`)
- FastAPI App → JWT Security: authenticates (evidence: `backend/app/main.py`)
- FastAPI App → Online Room Routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI App → Experience Routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI App → Training Routes: registers routes (evidence: `backend/app/main.py`)
- Online Room Routes → Room Matchmaking: dispatches room actions (evidence: `backend/app/online_routes.py`)
- Room Matchmaking → Online Arena: runs online combat (evidence: `backend/app/online_rooms.py`)
- Room Matchmaking → Game Rules: uses rules (evidence: `backend/app/online_rooms.py`)
- Training Routes → Training League Service: dispatches league actions (evidence: `backend/app/training_routes.py`)
- Training League Service → Replay Scoring: scores submissions (evidence: `backend/app/training_service.py`)
- Training League Service → Season Rules: uses season rules (evidence: `backend/app/training_service.py`)
- Training League Service → Training Records: reads and writes (evidence: `backend/app/training_service.py`)
- Training League Service → Game Rules: uses game rules (evidence: `backend/app/training_service.py`)
- Experience Routes → Tutorial and Telemetry: records events (evidence: `backend/app/experience_routes.py`)
- Experience Routes → Experience Records: reads and writes (evidence: `backend/app/experience_routes.py`)
- Tutorial and Telemetry → Experience Records: stores events (evidence: `backend/app/experience.py`)
- FastAPI App → Player and Match Records: uses account and match data (evidence: `backend/app/main.py`)
- FastAPI App → Game Rules: applies rules (evidence: `backend/app/main.py`)
- Player and Match Records → Database Session: maps records (evidence: `backend/app/models.py`)
- Experience Records → Database Session: maps records (evidence: `backend/app/experience_models.py`)
- Training Records → Database Session: maps records (evidence: `backend/app/training_models.py`)
- Database Session → Runtime Configuration: loads connection settings (evidence: `backend/app/database.py`)
