# k1tbyte/wand-enhancer architecture

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

- Interactive diagram: https://gitdiagram.com/k1tbyte/wand-enhancer
- Repository: https://github.com/k1tbyte/wand-enhancer

## Overview

WandEnhancer is a Windows patcher and interoperability layer for the Wand desktop client, with an optional LAN Remote Web Panel. The main workflows are selecting or reapplying local patches before launching Wand, and connecting a phone browser to the panel to inspect the library and control an active trainer. The README also documents injected custom renderer scripts and client-side configuration, layout, and theme adjustments. Several subsystems are represented from the tree and README; their internal wiring is omitted where source excerpts do not establish it.

Main entry points: [`web-panel/bridge/src/server.ts`](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/server.ts) (HTTP and WebSocket), [`WandEnhancer/Program.cs`](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Program.cs) (Startup and launch), [`WandEnhancer/Core/Enhancer.cs`](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Enhancer.cs) (Enhancer workflow), [`web-panel/src/app/app.tsx`](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/app/app.tsx) (Panel application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop app"]
  node_desktopui["Patch and settings UI<br/>[MainWindowVm.cs]"]
  node_program["Startup and launch<br/>[Program.cs]"]
  node_settings[("Local settings<br/>[SettingsManager.cs]")]
end

subgraph group_patching["Client patching"]
  node_enhancer["Enhancer workflow<br/>[Enhancer.cs]"]
  node_strategy["Patch strategies<br/>[StrategyFactory.cs]"]
  node_asar["ASAR patching<br/>[AsarCreator.cs]"]
  node_contentpatch["Renderer injection"]
  node_patchscripts["Injected scripts"]
  node_customscripts["Custom renderer scripts"]
end

subgraph group_panel["Remote panel"]
end

subgraph group_webui["Panel interface"]
  node_app["Panel application<br/>[app.tsx]"]
  node_sessionhook["Session management"]
  node_sessionclient["WebSocket client"]
  node_trainerui["Trainer controls"]
  node_libraryui["Game library<br/>[LibraryDrawer.tsx]"]
  node_webstorage[("Panel preferences<br/>[storage.ts]")]
end

subgraph group_bridge["Panel bridge"]
  node_httpserver["HTTP and WebSocket<br/>[server.ts]"]
  node_bridgeprotocol["Protocol validation<br/>[protocol-router.ts]"]
  node_bridgestate["Session snapshot<br/>[bridge-state.ts]"]
  node_bridgeruntime["Wand integration<br/>[runtime.ts]"]
  node_panelfiles["Panel assets<br/>[server-files.ts]"]
end

node_user(("Wand user"))
node_wandinstall[("Local Wand install")]
node_wandclient["Wand client"]
node_phone(("Phone browser"))

node_user -->|"configures patches"| node_desktopui
node_program -->|"opens UI"| node_desktopui
node_program -->|"loads settings"| node_settings
node_desktopui -->|"saves settings"| node_settings
node_program -->|"auto-patches"| node_enhancer
node_program -->|"selects strategy"| node_strategy
node_enhancer -->|"applies strategy"| node_strategy
node_enhancer -->|"updates archive"| node_asar
node_enhancer -->|"injects panel"| node_contentpatch
node_contentpatch -->|"modifies files"| node_wandinstall
node_asar -->|"writes archive"| node_wandinstall
node_contentpatch -.->|"bundles scripts"| node_patchscripts
node_wandinstall -->|"launches"| node_wandclient
node_user -->|"scans QR code"| node_phone
node_phone -->|"connects over LAN"| node_httpserver
node_httpserver -->|"serves assets"| node_panelfiles
node_httpserver -->|"validates messages"| node_bridgeprotocol
node_httpserver -->|"sends snapshots"| node_bridgestate
node_bridgestate -->|"provides snapshot"| node_httpserver
node_httpserver -->|"dispatches commands"| node_bridgeruntime
node_httpserver -->|"dispatches value changes"| node_bridgeruntime
node_phone -->|"uses panel"| node_app
node_app -->|"renders session"| node_sessionhook
node_sessionhook -->|"manages connection"| node_sessionclient
node_sessionclient -->|"exchanges messages"| node_httpserver
node_app -->|"renders controls"| node_trainerui
node_app -->|"renders library"| node_libraryui
node_sessionhook -->|"persists preferences"| node_webstorage
node_bridgeruntime -->|"exchanges renderer data"| node_wandclient
node_wandclient -.->|"runs injected scripts"| node_customscripts

click node_desktopui "https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/View/MainWindow/MainWindowVm.cs"
click node_program "https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Program.cs"
click node_settings "https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Services/SettingsManager.cs"
click node_enhancer "https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Enhancer.cs"
click node_strategy "https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Patching/Strategies/StrategyFactory.cs"
click node_asar "https://github.com/k1tbyte/wand-enhancer/blob/master/AsarSharp/AsarCreator.cs"
click node_contentpatch "https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Patching/Content/RemotePanelInjector.cs"
click node_patchscripts "https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Patches/remote-bridge-boot.js"
click node_app "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/app/app.tsx"
click node_sessionhook "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/app/use-remote-panel.ts"
click node_sessionclient "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/remote-session/remote-session.client.ts"
click node_trainerui "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/trainer/ui/CategorySection.tsx"
click node_libraryui "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/library/ui/LibraryDrawer.tsx"
click node_webstorage "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/shared/storage.ts"
click node_httpserver "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/server.ts"
click node_bridgeprotocol "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/protocol-router.ts"
click node_bridgestate "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/bridge-state.ts"
click node_bridgeruntime "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/wand/runtime.ts"
click node_panelfiles "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/server-files.ts"
click node_customscripts "https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/wand/renderer-scripts.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_desktopui,node_program,node_settings,node_user,node_wandclient,node_phone toneBlue
class node_enhancer,node_strategy,node_asar,node_contentpatch,node_patchscripts,node_customscripts,node_wandinstall toneAmber
class node_app,node_sessionhook,node_sessionclient,node_trainerui,node_libraryui,node_webstorage toneRose
class node_httpserver,node_bridgeprotocol,node_bridgestate,node_bridgeruntime,node_panelfiles toneIndigo
```

## Components

### Desktop app

- [Patch and settings UI](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/View/MainWindow/MainWindowVm.cs): `WandEnhancer/View/MainWindow/MainWindowVm.cs`
- [Startup and launch](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Program.cs): `WandEnhancer/Program.cs`
- [Local settings](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Services/SettingsManager.cs): `WandEnhancer/Core/Services/SettingsManager.cs`

### Client patching

- [Enhancer workflow](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Enhancer.cs): `WandEnhancer/Core/Enhancer.cs`
- [Patch strategies](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Patching/Strategies/StrategyFactory.cs): `WandEnhancer/Core/Patching/Strategies/StrategyFactory.cs`
- [ASAR patching](https://github.com/k1tbyte/wand-enhancer/blob/master/AsarSharp/AsarCreator.cs): `AsarSharp/AsarCreator.cs`
- [Renderer injection](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Core/Patching/Content/RemotePanelInjector.cs): `WandEnhancer/Core/Patching/Content/RemotePanelInjector.cs`
- [Injected scripts](https://github.com/k1tbyte/wand-enhancer/blob/master/WandEnhancer/Patches/remote-bridge-boot.js): `WandEnhancer/Patches/remote-bridge-boot.js`
- [Custom renderer scripts](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/wand/renderer-scripts.ts): `web-panel/bridge/src/wand/renderer-scripts.ts`

### Panel interface

- [Panel application](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/app/app.tsx): `web-panel/src/app/app.tsx`
- [Session management](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/app/use-remote-panel.ts): `web-panel/src/app/use-remote-panel.ts`
- [WebSocket client](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/remote-session/remote-session.client.ts): `web-panel/src/remote-session/remote-session.client.ts`
- [Trainer controls](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/trainer/ui/CategorySection.tsx): `web-panel/src/trainer/ui/CategorySection.tsx`
- [Game library](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/library/ui/LibraryDrawer.tsx): `web-panel/src/library/ui/LibraryDrawer.tsx`
- [Panel preferences](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/src/shared/storage.ts): `web-panel/src/shared/storage.ts`

### Panel bridge

- [HTTP and WebSocket](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/server.ts): `web-panel/bridge/src/server.ts`
- [Protocol validation](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/protocol-router.ts): `web-panel/bridge/src/protocol-router.ts`
- [Session snapshot](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/bridge-state.ts): `web-panel/bridge/src/bridge-state.ts`
- [Wand integration](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/wand/runtime.ts): `web-panel/bridge/src/wand/runtime.ts`
- [Panel assets](https://github.com/k1tbyte/wand-enhancer/blob/master/web-panel/bridge/src/server-files.ts): `web-panel/bridge/src/server-files.ts`

### Other components

- **Wand user**
- **Local Wand install**
- **Wand client**
- **Phone browser**

## Connections

- Wand user → Patch and settings UI: configures patches
- Startup and launch → Patch and settings UI: opens UI
- Startup and launch → Local settings: loads settings
- Patch and settings UI → Local settings: saves settings
- Startup and launch → Enhancer workflow: auto-patches
- Startup and launch → Patch strategies: selects strategy
- Enhancer workflow → Patch strategies: applies strategy
- Enhancer workflow → ASAR patching: updates archive
- Enhancer workflow → Renderer injection: injects panel
- Renderer injection → Local Wand install: modifies files
- ASAR patching → Local Wand install: writes archive
- Renderer injection → Injected scripts: bundles scripts
- Local Wand install → Wand client: launches
- Wand user → Phone browser: scans QR code
- Phone browser → HTTP and WebSocket: connects over LAN
- HTTP and WebSocket → Panel assets: serves assets
- HTTP and WebSocket → Protocol validation: validates messages
- HTTP and WebSocket → Session snapshot: sends snapshots
- Session snapshot → HTTP and WebSocket: provides snapshot
- HTTP and WebSocket → Wand integration: dispatches commands
- HTTP and WebSocket → Wand integration: dispatches value changes
- Phone browser → Panel application: uses panel
- Panel application → Session management: renders session
- Session management → WebSocket client: manages connection
- WebSocket client → HTTP and WebSocket: exchanges messages
- Panel application → Trainer controls: renders controls
- Panel application → Game library: renders library
- Session management → Panel preferences: persists preferences
- Wand integration → Wand client: exchanges renderer data
- Wand client → Custom renderer scripts: runs injected scripts
