# rudtjr1106/poketdesktop architecture

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

- Interactive diagram: https://gitdiagram.com/rudtjr1106/poketdesktop
- Repository: https://github.com/rudtjr1106/poketdesktop

## Overview

Poketdesktop is a desktop Pokémon-raising game backed by a shared server. The main loop is desktop exploration and wild encounters, followed by server-resolved battles and collection/progression shown in the desktop UI. Other major branches include gyms, player battles, raids, social/guild features, and inventory. The README documents these capabilities; source excerpts show selected client, battle, database, and shared-rule behavior, so links for unsampled feature modules are omitted or marked unverified.

Main entry points: [`client/poketdesktop/app.py`](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/app.py) (Desktop runtime), [`server/app/main.py`](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/main.py) (Server application), [`server/app/db.py`](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/db.py) (Game database), [`common/battle.py`](https://github.com/rudtjr1106/poketdesktop/blob/main/common/battle.py) (Battle engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop game"]
  node_desktop_app["Desktop runtime<br/>[app.py]"]
  node_desktop_api["API client<br/>[api.py]"]
  node_desktop_world["World overlay<br/>[overlay.py]"]
  node_desktop_box["Pokémon management<br/>[ui_box.py]"]
  node_desktop_bag["Bag and shop<br/>[ui_bag.py]"]
  node_desktop_gym["Gym interface<br/>[ui_gym.py]"]
  node_desktop_pvp["Player battles<br/>[ui_live_battle.py]"]
  node_desktop_social["Social and guild UI<br/>[ui_guild.py]"]
end

subgraph group_server["Game services"]
  node_wild_battle["Wild battle API<br/>[battle_routes.py]"]
  node_gym_service["Gym service<br/>[gym.py]"]
  node_pvp_service["Player battle service<br/>[pvp.py]"]
  node_raid_service["Raid service<br/>[raid.py]"]
  node_inventory["Items and inventory<br/>[items.py]"]
  node_eggs["Eggs<br/>[eggs.py]"]
  node_server_entry["Server application<br/>[main.py]"]
end

subgraph group_rules["Shared game rules"]
  node_rules["Pokémon rules<br/>[pokelogic.py]"]
  node_battle_engine["Battle engine<br/>[battle.py]"]
  node_battle_math["Battle calculations<br/>[movecalc.py]"]
  node_abilities["Abilities and items<br/>[abilities.py]"]
  node_held_items["Held-item effects<br/>[held.py]"]
end

subgraph group_community["Social play"]
  node_guild["Guild services<br/>[guild.py]"]
  node_social["Friends and social<br/>[social.py]"]
end

subgraph group_state["Persistence"]
  node_database[("Game database<br/>[db.py]")]
end

node_player(("Player"))

node_player -->|"plays"| node_desktop_app
node_desktop_app -->|"calls"| node_desktop_api
node_desktop_app -->|"drives"| node_desktop_world
node_desktop_app -->|"opens"| node_desktop_box
node_desktop_app -.->|"opens"| node_desktop_bag
node_desktop_app -.->|"opens"| node_desktop_gym
node_desktop_app -.->|"shows"| node_desktop_pvp
node_desktop_app -.->|"opens"| node_desktop_social
node_desktop_api -.->|"requests"| node_server_entry
node_server_entry -->|"routes"| node_wild_battle
node_server_entry -->|"routes"| node_gym_service
node_server_entry -->|"routes"| node_pvp_service
node_server_entry -->|"routes"| node_raid_service
node_server_entry -->|"routes"| node_inventory
node_server_entry -->|"routes"| node_guild
node_server_entry -->|"routes"| node_social
node_wild_battle -->|"resolves"| node_battle_engine
node_wild_battle -->|"reads and writes"| node_database
node_wild_battle -->|"uses items"| node_inventory
node_battle_engine -->|"uses"| node_abilities
node_battle_engine -->|"uses"| node_held_items
node_battle_engine -->|"calculates damage"| node_battle_math
node_battle_engine -->|"uses rules"| node_rules
node_abilities -->|"calculates"| node_battle_math
node_held_items -->|"uses"| node_battle_math
node_inventory -->|"stores items"| node_database
node_inventory -->|"creates eggs"| node_eggs
node_pvp_service -->|"reads and writes"| node_database
node_gym_service -.->|"uses"| node_database
node_raid_service -.->|"uses"| node_database
node_guild -.->|"uses"| node_database
node_social -.->|"uses"| node_database

click node_desktop_app "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/app.py"
click node_desktop_api "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/api.py"
click node_desktop_world "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/overlay.py"
click node_desktop_box "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_box.py"
click node_desktop_bag "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_bag.py"
click node_desktop_gym "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_gym.py"
click node_desktop_pvp "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_live_battle.py"
click node_desktop_social "https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_guild.py"
click node_wild_battle "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/battle_routes.py"
click node_gym_service "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/gym.py"
click node_pvp_service "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/pvp.py"
click node_raid_service "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/raid.py"
click node_inventory "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/items.py"
click node_eggs "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/eggs.py"
click node_guild "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/guild.py"
click node_social "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/social.py"
click node_rules "https://github.com/rudtjr1106/poketdesktop/blob/main/common/pokelogic.py"
click node_battle_engine "https://github.com/rudtjr1106/poketdesktop/blob/main/common/battle.py"
click node_battle_math "https://github.com/rudtjr1106/poketdesktop/blob/main/common/movecalc.py"
click node_abilities "https://github.com/rudtjr1106/poketdesktop/blob/main/common/abilities.py"
click node_held_items "https://github.com/rudtjr1106/poketdesktop/blob/main/common/held.py"
click node_database "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/db.py"
click node_server_entry "https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/main.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_desktop_app,node_desktop_api,node_desktop_world,node_desktop_box,node_desktop_bag,node_desktop_gym,node_desktop_pvp,node_desktop_social toneBlue
class node_wild_battle,node_gym_service,node_pvp_service,node_raid_service,node_inventory,node_eggs,node_server_entry toneAmber
class node_rules,node_battle_engine,node_battle_math,node_abilities,node_held_items toneMint
class node_guild,node_social toneRose
class node_database,node_player toneIndigo
```

## Components

### Desktop game

- [Desktop runtime](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/app.py): `client/poketdesktop/app.py`
- [API client](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/api.py): `client/poketdesktop/api.py`
- [World overlay](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/overlay.py): `client/poketdesktop/overlay.py`
- [Pokémon management](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_box.py): `client/poketdesktop/ui_box.py`
- [Bag and shop](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_bag.py): `client/poketdesktop/ui_bag.py`
- [Gym interface](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_gym.py): `client/poketdesktop/ui_gym.py`
- [Player battles](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_live_battle.py): `client/poketdesktop/ui_live_battle.py`
- [Social and guild UI](https://github.com/rudtjr1106/poketdesktop/blob/main/client/poketdesktop/ui_guild.py): `client/poketdesktop/ui_guild.py`

### Game services

- [Wild battle API](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/battle_routes.py): `server/app/battle_routes.py`
- [Gym service](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/gym.py): `server/app/gym.py`
- [Player battle service](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/pvp.py): `server/app/pvp.py`
- [Raid service](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/raid.py): `server/app/raid.py`
- [Items and inventory](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/items.py): `server/app/items.py`
- [Eggs](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/eggs.py): `server/app/eggs.py`
- [Server application](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/main.py): `server/app/main.py`

### Shared game rules

- [Pokémon rules](https://github.com/rudtjr1106/poketdesktop/blob/main/common/pokelogic.py): `common/pokelogic.py`
- [Battle engine](https://github.com/rudtjr1106/poketdesktop/blob/main/common/battle.py): `common/battle.py`
- [Battle calculations](https://github.com/rudtjr1106/poketdesktop/blob/main/common/movecalc.py): `common/movecalc.py`
- [Abilities and items](https://github.com/rudtjr1106/poketdesktop/blob/main/common/abilities.py): `common/abilities.py`
- [Held-item effects](https://github.com/rudtjr1106/poketdesktop/blob/main/common/held.py): `common/held.py`

### Social play

- [Guild services](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/guild.py): `server/app/guild.py`
- [Friends and social](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/social.py): `server/app/social.py`

### Persistence

- [Game database](https://github.com/rudtjr1106/poketdesktop/blob/main/server/app/db.py): `server/app/db.py`

### Other components

- **Player**

## Connections

- Player → Desktop runtime: plays
- Desktop runtime → API client: calls (evidence: `client/poketdesktop/app.py`)
- Desktop runtime → World overlay: drives (evidence: `client/poketdesktop/app.py`)
- Desktop runtime → Pokémon management: opens (evidence: `client/poketdesktop/app.py`)
- Desktop runtime → Bag and shop: opens (evidence: `client/poketdesktop/app.py`)
- Desktop runtime → Gym interface: opens
- Desktop runtime → Player battles: shows (evidence: `client/poketdesktop/app.py`)
- Desktop runtime → Social and guild UI: opens (evidence: `client/poketdesktop/app.py`)
- API client → Server application: requests
- Server application → Wild battle API: routes (evidence: `server/app/main.py`)
- Server application → Gym service: routes (evidence: `server/app/main.py`)
- Server application → Player battle service: routes (evidence: `server/app/main.py`)
- Server application → Raid service: routes (evidence: `server/app/main.py`)
- Server application → Items and inventory: routes (evidence: `server/app/main.py`)
- Server application → Guild services: routes (evidence: `server/app/main.py`)
- Server application → Friends and social: routes (evidence: `server/app/main.py`)
- Wild battle API → Battle engine: resolves (evidence: `server/app/battle_routes.py`)
- Wild battle API → Game database: reads and writes (evidence: `server/app/battle_routes.py`)
- Wild battle API → Items and inventory: uses items (evidence: `server/app/battle_routes.py`)
- Battle engine → Abilities and items: uses (evidence: `common/battle.py`)
- Battle engine → Held-item effects: uses (evidence: `common/battle.py`)
- Battle engine → Battle calculations: calculates damage (evidence: `common/battle.py`)
- Battle engine → Pokémon rules: uses rules (evidence: `common/battle.py`)
- Abilities and items → Battle calculations: calculates (evidence: `common/abilities.py`)
- Held-item effects → Battle calculations: uses (evidence: `common/held.py`)
- Items and inventory → Game database: stores items (evidence: `server/app/items.py`)
- Items and inventory → Eggs: creates eggs (evidence: `server/app/items.py`)
- Player battle service → Game database: reads and writes (evidence: `server/app/pvp.py`)
- Gym service → Game database: uses
- Raid service → Game database: uses
- Guild services → Game database: uses
- Friends and social → Game database: uses
