# setube/ogame-vue-ts architecture

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

- Interactive diagram: https://gitdiagram.com/setube/ogame-vue-ts
- Repository: https://github.com/setube/ogame-vue-ts

## Overview

#### Purpose and Delivery Targets
OGame Vue TS is a local-first, single-player space-strategy game: browser gameplay, encrypted local persistence, optional WebDAV backup/sync, and packaged desktop/mobile delivery. The primary web bootstrap is `src/main.ts`, which mounts the Vue application from `src/App.vue`. Alternative shells include Electron (`electron/main.ts`), Capacitor Android (`android/app/src/main/java/games/wenzi/ogame/MainActivity.java`), and a Go-based web-service build target (`main.go`).

#### Application Composition and Navigation
Vue 3 + TypeScript provides the client runtime; Pinia stores own mutable game/UI state and Vue Router selects gameplay screens. The root app coordinates global layout, dialogs, notifications, and routed content. Major game domains are represented as views—empire construction, research, fleets, galaxy, diplomacy, campaign, rankings, settings, and battle simulation.
Paths: `src/App.vue`, `src/router/index.ts`, `src/views/OverviewView.vue`, `src/views/GalaxyView.vue`, `src/views/BattleSimulatorView.vue`.

#### State, Persistence, and Security Boundary
The game is designed to run without a central game backend. `gameStore` is the primary gameplay state boundary; universe/NPC state and detail-dialog state are separated into dedicated Pinia stores. Persisted progress is encrypted before browser-local storage through crypto and migration utilities. This makes browser storage the authoritative save source, while version/migration handling protects upgrades.
Paths: `src/stores/gameStore.ts`, `src/stores/universeStore.ts`, `src/utils/crypto.ts`, `src/utils/migration.ts`.

#### Rules Engine and Simulation Pipeline
Domain logic is deliberately separated from Vue components. Player actions flow from views/stores into rules modules that validate prerequisites, compute resource costs and timers, manage queues, and update empire state. The core domains cover buildings, research, ships/defense, fleets, planets/moons, officers, diplomacy, achievements, campaign progression, and resource production. Battle calculation is isolated further for simulator and combat-report consumers.
Paths: `src/logic/gameLogic.ts`, `src/logic/buildingLogic.ts`, `src/logic/fleetLogic.ts`, `src/logic/battleLogic.ts`, `src/utils/battleSimulator.ts`.

#### Asynchronous Gameplay and Heavy Computation
Time-based construction/research/fleet work is modeled through queue logic and UI queue animation. Battle processing can execute in a Web Worker, keeping expensive simulations off the main rendering thread; `workerManager` is the application-side worker boundary. Resulting state drives reports, alerts, unlock overlays, and other gameplay dialogs rather than requiring server callbacks.
Paths: `src/logic/waitingQueueLogic.ts`, `src/composables/useQueueAnimation.ts`, `src/workers/battle.worker.ts`, `src/workers/workerManager.ts`, `src/components/dialogs/BattleReportDialog.vue`.

#### Content, UX, and Localization
Static game balance/content is centralized in configuration modules, while components render domain-specific interfaces and reusable shadcn-vue-style primitives. Custom i18n selects among bundled locale dictionaries. Theme behavior is client-side and styling is rooted in global CSS/Tailwind variables.
Paths: `src/config/gameConfig.ts`, `src/config/campaignConfig.ts`, `src/composables/useI18n.ts`, `src/locales/index.ts`, `src/style.css`.

#### External Integration and Deployment
WebDAV is the main external service integration, exposed through settings dialogs and a dedicated service rather than embedded in game logic. Builds use Vite/Node; Docker/Nginx support browser deployment. Electron, Android Capacitor/Gradle, and Go provide platform-specific packaging or serving routes, with CI workflows building and publishing artifacts.
Paths: `src/services/webdavService.ts`, `src/components/settings/WebDAVConfigDialog.vue`, `Dockerfile`, `nginx.conf`, `capacitor.config.ts`.

Main entry points: [`src/main.ts`](https://github.com/setube/ogame-vue-ts/blob/main/src/main.ts) (Vue bootstrap), [`src/views/OverviewView.vue`](https://github.com/setube/ogame-vue-ts/blob/main/src/views/OverviewView.vue) (Game views), [`src/logic/gameLogic.ts`](https://github.com/setube/ogame-vue-ts/blob/main/src/logic/gameLogic.ts) (Game rules), [`src/App.vue`](https://github.com/setube/ogame-vue-ts/blob/main/src/App.vue) (Root application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Vue Client"]
  node_bootstrap{{"Vue bootstrap<br/>entrypoint<br/>[main.ts]"}}
  node_app["Root application<br/>Vue root<br/>[App.vue]"]
  node_router["Gameplay router<br/>Vue Router<br/>[index.ts]"]
  node_views["Game views<br/>Vue screens<br/>[OverviewView.vue]"]
  node_game_store["Game state<br/>Pinia store<br/>[gameStore.ts]"]
  node_universe_store["Universe state<br/>Pinia store<br/>[universeStore.ts]"]
  node_i18n["Localization<br/>i18n composable<br/>[useI18n.ts]"]
  node_battle_report["Battle reports<br/>Vue dialog"]
end

subgraph group_gameplay["Gameplay Engine"]
  node_game_logic["Game rules<br/>domain logic<br/>[gameLogic.ts]"]
  node_building_logic["Building rules<br/>domain logic<br/>[buildingLogic.ts]"]
  node_fleet_logic["Fleet rules<br/>domain logic<br/>[fleetLogic.ts]"]
  node_queue_logic["Timed queues<br/>queue logic"]
  node_battle_logic["Battle rules<br/>combat logic<br/>[battleLogic.ts]"]
  node_battle_worker{{"Battle worker<br/>Web Worker<br/>[battle.worker.ts]"}}
  node_worker_manager["Worker manager<br/>worker boundary<br/>[workerManager.ts]"]
  node_game_config["Game content<br/>balance config<br/>[gameConfig.ts]"]
end

subgraph group_storage["Save and Sync"]
  node_save_crypto["Encrypted saves<br/>crypto and migration<br/>[crypto.ts]"]
  node_local_storage[("Browser local storage<br/>authoritative save")]
  node_webdav["WebDAV backup<br/>sync service<br/>[webdavService.ts]"]
  node_webdav_settings["WebDAV settings<br/>Vue dialog"]
end

subgraph group_delivery["Delivery Targets"]
  node_web_build["Web deployment<br/>Vite Docker/Nginx"]
  node_electron["Electron desktop<br/>desktop shell<br/>[main.ts]"]
  node_android["Capacitor Android<br/>mobile shell<br/>[MainActivity.java]"]
  node_go_target["Go web service<br/>server target<br/>[main.go]"]
end

node_bootstrap -->|"mounts"| node_app
node_app -->|"hosts"| node_router
node_router -->|"selects"| node_views
node_views -->|"reads and dispatches actions"| node_game_store
node_views -->|"reads"| node_universe_store
node_views -->|"localizes"| node_i18n
node_game_store -->|"applies actions through"| node_game_logic
node_game_logic -->|"uses"| node_building_logic
node_game_logic -->|"uses"| node_fleet_logic
node_game_logic -->|"schedules"| node_queue_logic
node_game_logic -->|"uses rules and balance"| node_game_config
node_views -->|"requests simulations"| node_worker_manager
node_worker_manager -->|"dispatches"| node_battle_worker
node_battle_worker -->|"executes"| node_battle_logic
node_worker_manager -->|"returns results to"| node_battle_report
node_game_store -->|"persists through"| node_save_crypto
node_save_crypto -->|"encrypted save"| node_local_storage
node_webdav_settings -->|"configures"| node_webdav
node_webdav -.->|"backs up and restores"| node_local_storage
node_app -->|"opens"| node_webdav_settings
node_bootstrap -.->|"built for"| node_web_build
node_bootstrap -.->|"packaged in"| node_electron
node_bootstrap -.->|"packaged in"| node_android
node_bootstrap -.->|"served by"| node_go_target

click node_bootstrap "https://github.com/setube/ogame-vue-ts/blob/main/src/main.ts"
click node_app "https://github.com/setube/ogame-vue-ts/blob/main/src/App.vue"
click node_router "https://github.com/setube/ogame-vue-ts/blob/main/src/router/index.ts"
click node_views "https://github.com/setube/ogame-vue-ts/blob/main/src/views/OverviewView.vue"
click node_game_store "https://github.com/setube/ogame-vue-ts/blob/main/src/stores/gameStore.ts"
click node_universe_store "https://github.com/setube/ogame-vue-ts/blob/main/src/stores/universeStore.ts"
click node_i18n "https://github.com/setube/ogame-vue-ts/blob/main/src/composables/useI18n.ts"
click node_game_logic "https://github.com/setube/ogame-vue-ts/blob/main/src/logic/gameLogic.ts"
click node_building_logic "https://github.com/setube/ogame-vue-ts/blob/main/src/logic/buildingLogic.ts"
click node_fleet_logic "https://github.com/setube/ogame-vue-ts/blob/main/src/logic/fleetLogic.ts"
click node_queue_logic "https://github.com/setube/ogame-vue-ts/blob/main/src/logic/waitingQueueLogic.ts"
click node_battle_logic "https://github.com/setube/ogame-vue-ts/blob/main/src/logic/battleLogic.ts"
click node_battle_worker "https://github.com/setube/ogame-vue-ts/blob/main/src/workers/battle.worker.ts"
click node_worker_manager "https://github.com/setube/ogame-vue-ts/blob/main/src/workers/workerManager.ts"
click node_battle_report "https://github.com/setube/ogame-vue-ts/blob/main/src/components/dialogs/BattleReportDialog.vue"
click node_save_crypto "https://github.com/setube/ogame-vue-ts/blob/main/src/utils/crypto.ts"
click node_webdav "https://github.com/setube/ogame-vue-ts/blob/main/src/services/webdavService.ts"
click node_webdav_settings "https://github.com/setube/ogame-vue-ts/blob/main/src/components/settings/WebDAVConfigDialog.vue"
click node_game_config "https://github.com/setube/ogame-vue-ts/blob/main/src/config/gameConfig.ts"
click node_web_build "https://github.com/setube/ogame-vue-ts/tree/main/Dockerfile"
click node_electron "https://github.com/setube/ogame-vue-ts/blob/main/electron/main.ts"
click node_android "https://github.com/setube/ogame-vue-ts/blob/main/android/app/src/main/java/games/wenzi/ogame/MainActivity.java"
click node_go_target "https://github.com/setube/ogame-vue-ts/blob/main/main.go"

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_app,node_router,node_views,node_game_store,node_universe_store,node_i18n,node_battle_report toneBlue
class node_game_logic,node_building_logic,node_fleet_logic,node_queue_logic,node_battle_logic,node_battle_worker,node_worker_manager,node_game_config toneAmber
class node_save_crypto,node_local_storage,node_webdav,node_webdav_settings toneMint
class node_web_build,node_electron,node_android,node_go_target toneRose
```

## Components

### Vue Client

- [Vue bootstrap](https://github.com/setube/ogame-vue-ts/blob/main/src/main.ts): entrypoint · `src/main.ts`
- [Root application](https://github.com/setube/ogame-vue-ts/blob/main/src/App.vue): Vue root · Coordinates layout, dialogs, notifications, and routed content. · `src/App.vue`
- [Gameplay router](https://github.com/setube/ogame-vue-ts/blob/main/src/router/index.ts): Vue Router · `src/router/index.ts`
- [Game views](https://github.com/setube/ogame-vue-ts/blob/main/src/views/OverviewView.vue): Vue screens · Overview, galaxy, battle simulator, and other domain screens. · `src/views/OverviewView.vue`
- [Game state](https://github.com/setube/ogame-vue-ts/blob/main/src/stores/gameStore.ts): Pinia store · Primary mutable gameplay-state boundary. · `src/stores/gameStore.ts`
- [Universe state](https://github.com/setube/ogame-vue-ts/blob/main/src/stores/universeStore.ts): Pinia store · Separates universe and NPC state from player state. · `src/stores/universeStore.ts`
- [Localization](https://github.com/setube/ogame-vue-ts/blob/main/src/composables/useI18n.ts): i18n composable · `src/composables/useI18n.ts`
- [Battle reports](https://github.com/setube/ogame-vue-ts/blob/main/src/components/dialogs/BattleReportDialog.vue): Vue dialog · `src/components/dialogs/BattleReportDialog.vue`

### Gameplay Engine

- [Game rules](https://github.com/setube/ogame-vue-ts/blob/main/src/logic/gameLogic.ts): domain logic · Validates actions and applies empire progression rules. · `src/logic/gameLogic.ts`
- [Building rules](https://github.com/setube/ogame-vue-ts/blob/main/src/logic/buildingLogic.ts): domain logic · Computes building prerequisites, costs, and timers. · `src/logic/buildingLogic.ts`
- [Fleet rules](https://github.com/setube/ogame-vue-ts/blob/main/src/logic/fleetLogic.ts): domain logic · `src/logic/fleetLogic.ts`
- [Timed queues](https://github.com/setube/ogame-vue-ts/blob/main/src/logic/waitingQueueLogic.ts): queue logic · Models construction, research, and fleet work. · `src/logic/waitingQueueLogic.ts`
- [Battle rules](https://github.com/setube/ogame-vue-ts/blob/main/src/logic/battleLogic.ts): combat logic · `src/logic/battleLogic.ts`
- [Battle worker](https://github.com/setube/ogame-vue-ts/blob/main/src/workers/battle.worker.ts): Web Worker · Runs expensive combat simulation off the rendering thread. · `src/workers/battle.worker.ts`
- [Worker manager](https://github.com/setube/ogame-vue-ts/blob/main/src/workers/workerManager.ts): worker boundary · `src/workers/workerManager.ts`
- [Game content](https://github.com/setube/ogame-vue-ts/blob/main/src/config/gameConfig.ts): balance config · Centralized game balance and campaign content. · `src/config/gameConfig.ts`

### Save and Sync

- [Encrypted saves](https://github.com/setube/ogame-vue-ts/blob/main/src/utils/crypto.ts): crypto and migration · Encrypts and upgrades persisted game progress. · `src/utils/crypto.ts`
- **Browser local storage**: authoritative save
- [WebDAV backup](https://github.com/setube/ogame-vue-ts/blob/main/src/services/webdavService.ts): sync service · Optional external backup and sync integration. · `src/services/webdavService.ts`
- [WebDAV settings](https://github.com/setube/ogame-vue-ts/blob/main/src/components/settings/WebDAVConfigDialog.vue): Vue dialog · `src/components/settings/WebDAVConfigDialog.vue`

### Delivery Targets

- [Web deployment](https://github.com/setube/ogame-vue-ts/tree/main/Dockerfile): Vite Docker/Nginx · `Dockerfile`
- [Electron desktop](https://github.com/setube/ogame-vue-ts/blob/main/electron/main.ts): desktop shell · `electron/main.ts`
- [Capacitor Android](https://github.com/setube/ogame-vue-ts/blob/main/android/app/src/main/java/games/wenzi/ogame/MainActivity.java): mobile shell · `android/app/src/main/java/games/wenzi/ogame/MainActivity.java`
- [Go web service](https://github.com/setube/ogame-vue-ts/blob/main/main.go): server target · `main.go`

## Connections

- Vue bootstrap → Root application: mounts
- Root application → Gameplay router: hosts
- Gameplay router → Game views: selects
- Game views → Game state: reads and dispatches actions
- Game views → Universe state: reads
- Game views → Localization: localizes
- Game state → Game rules: applies actions through
- Game rules → Building rules: uses
- Game rules → Fleet rules: uses
- Game rules → Timed queues: schedules
- Game rules → Game content: uses rules and balance
- Game views → Worker manager: requests simulations
- Worker manager → Battle worker: dispatches
- Battle worker → Battle rules: executes
- Worker manager → Battle reports: returns results to
- Game state → Encrypted saves: persists through
- Encrypted saves → Browser local storage: encrypted save
- WebDAV settings → WebDAV backup: configures
- WebDAV backup → Browser local storage: backs up and restores
- Root application → WebDAV settings: opens
- Vue bootstrap → Web deployment: built for
- Vue bootstrap → Electron desktop: packaged in
- Vue bootstrap → Capacitor Android: packaged in
- Vue bootstrap → Go web service: served by
