# wjz-p/sona architecture

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

- Interactive diagram: https://gitdiagram.com/wjz-p/sona
- Repository: https://github.com/wjz-p/sona

## Overview

Sona is a Pengu Loader plugin that enhances the League of Legends client. Users open its panel to configure features, inspect match history and analysis, manage rewards and settings, and use tools; registered runtime features also modify client flows and UI. The architecture separates startup and feature dispatch, match intelligence and loadouts, client customization, and the React panel. Some capabilities are documented but their individual implementation files were not sampled, so those branches are linked only where the README supports them.

Main entry points: [`src/index.tsx`](https://github.com/wjz-p/sona/blob/main/src/index.tsx) (Plugin startup), [`src/lib/features/opgg-build-recommendation.ts`](https://github.com/wjz-p/sona/blob/main/src/lib/features/opgg-build-recommendation.ts) (OP.GG loadouts), [`src/App.tsx`](https://github.com/wjz-p/sona/blob/main/src/App.tsx) (Panel application), [`src/lib/lcu.ts`](https://github.com/wjz-p/sona/blob/main/src/lib/lcu.ts) (LCU client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Plugin runtime"]
  node_bootstrap["Plugin startup<br/>[index.tsx]"]
  node_feature_registry["Feature registry<br/>[features.ts]"]
  node_dom_injections["DOM injections<br/>[injections.ts]"]
  node_injector["DOM observer<br/>[InjectorManager.ts]"]
end

subgraph group_match["Match intelligence"]
  node_match_features["Match features"]
  node_history_ui["Match history"]
  node_detail_ui["Match details"]
  node_analysis_ui["Game analysis"]
  node_loadout_feature["OP.GG loadouts"]
  node_loadout_panel["Loadout panel"]
end

subgraph group_custom["Client customization"]
  node_beautify_features["Beautification features"]
  node_custom_avatar["Custom avatars<br/>[custom-avatar.ts]"]
  node_avatar_sync["Avatar status sync"]
end

subgraph group_panel["Sona panel"]
  node_app["Panel application<br/>[App.tsx]"]
  node_tools["Tools page<br/>[ToolsPage.tsx]"]
  node_beautify_page["Beautify page<br/>[BeautifyPage.tsx]"]
  node_rewards["Rewards page<br/>[RewardsPage.tsx]"]
end

subgraph group_services["Client services"]
  node_lcu["LCU client<br/>[lcu.ts]"]
  node_store[("Persistent settings<br/>[store.ts]")]
  node_opgg_api["OP.GG data API<br/>[opgg-api.ts]"]
  node_aram_api["ARAM.GG data API<br/>[aramgg-api.ts]"]
  node_assets["Game asset maps<br/>[assets.ts]"]
end

node_player(("Player"))
node_pengu["Pengu Loader"]

node_player -->|"opens panel"| node_app
node_pengu -->|"loads plugin"| node_bootstrap
node_bootstrap -->|"initializes"| node_feature_registry
node_bootstrap -->|"registers"| node_dom_injections
node_bootstrap -->|"mounts"| node_app
node_dom_injections -.->|"uses"| node_injector
node_feature_registry -->|"initializes"| node_match_features
node_feature_registry -.->|"initializes"| node_beautify_features
node_player -->|"queries matches"| node_history_ui
node_history_ui -->|"opens details"| node_detail_ui
node_player -->|"requests analysis"| node_analysis_ui
node_match_features -.->|"opens analysis"| node_analysis_ui
node_match_features -.->|"enables"| node_loadout_feature
node_loadout_feature -->|"renders"| node_loadout_panel
node_loadout_feature -->|"fetches builds"| node_opgg_api
node_loadout_feature -->|"fetches mode data"| node_aram_api
node_loadout_feature -->|"reads client state"| node_lcu
node_loadout_feature -->|"reads settings"| node_store
node_loadout_panel -->|"uses asset maps"| node_assets
node_beautify_features -.->|"includes"| node_custom_avatar
node_custom_avatar -->|"decodes status"| node_avatar_sync
node_custom_avatar -->|"updates client"| node_lcu
node_player -->|"customizes client"| node_beautify_page
node_beautify_page -->|"reads settings"| node_store
node_app -->|"routes to"| node_tools
node_app -->|"routes to"| node_beautify_page
node_app -->|"routes to"| node_rewards
node_player -->|"claims rewards"| node_rewards
node_tools -->|"opens history"| node_history_ui
node_tools -->|"uses client API"| node_lcu
node_bootstrap -->|"binds context"| node_lcu
node_bootstrap -->|"initializes maps"| node_assets

click node_bootstrap "https://github.com/wjz-p/sona/blob/main/src/index.tsx"
click node_feature_registry "https://github.com/wjz-p/sona/blob/main/src/lib/features.ts"
click node_dom_injections "https://github.com/wjz-p/sona/blob/main/src/lib/injections.ts"
click node_injector "https://github.com/wjz-p/sona/blob/main/src/lib/InjectorManager.ts"
click node_match_features "https://github.com/wjz-p/sona/tree/main/src/lib/features"
click node_history_ui "https://github.com/wjz-p/sona/blob/main/src/components/ui/MatchHistoryModal.tsx"
click node_detail_ui "https://github.com/wjz-p/sona/blob/main/src/components/ui/MatchDetailModal.tsx"
click node_analysis_ui "https://github.com/wjz-p/sona/blob/main/src/components/ui/GameAnalysisModal.tsx"
click node_loadout_feature "https://github.com/wjz-p/sona/blob/main/src/lib/features/opgg-build-recommendation.ts"
click node_loadout_panel "https://github.com/wjz-p/sona/blob/main/src/components/ui/OpggBuildRecommendationPanel.tsx"
click node_beautify_features "https://github.com/wjz-p/sona/tree/main/src/lib/features/beautify-client"
click node_custom_avatar "https://github.com/wjz-p/sona/blob/main/src/lib/features/beautify-client/custom-avatar.ts"
click node_avatar_sync "https://github.com/wjz-p/sona/blob/main/src/lib/features/beautify-client/avatar-status-sync.ts"
click node_app "https://github.com/wjz-p/sona/blob/main/src/App.tsx"
click node_tools "https://github.com/wjz-p/sona/blob/main/src/components/pages/ToolsPage.tsx"
click node_beautify_page "https://github.com/wjz-p/sona/blob/main/src/components/pages/BeautifyPage.tsx"
click node_rewards "https://github.com/wjz-p/sona/blob/main/src/components/pages/RewardsPage.tsx"
click node_lcu "https://github.com/wjz-p/sona/blob/main/src/lib/lcu.ts"
click node_store "https://github.com/wjz-p/sona/blob/main/src/lib/store.ts"
click node_opgg_api "https://github.com/wjz-p/sona/blob/main/src/lib/opgg-api.ts"
click node_aram_api "https://github.com/wjz-p/sona/blob/main/src/lib/aramgg-api.ts"
click node_assets "https://github.com/wjz-p/sona/blob/main/src/lib/assets.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_bootstrap,node_feature_registry,node_dom_injections,node_injector toneBlue
class node_match_features,node_history_ui,node_detail_ui,node_analysis_ui,node_loadout_feature,node_loadout_panel toneAmber
class node_beautify_features,node_custom_avatar,node_avatar_sync toneMint
class node_app,node_tools,node_beautify_page,node_rewards toneRose
class node_lcu,node_store,node_opgg_api,node_aram_api,node_assets,node_player,node_pengu toneIndigo
```

## Components

### Plugin runtime

- [Plugin startup](https://github.com/wjz-p/sona/blob/main/src/index.tsx): `src/index.tsx`
- [Feature registry](https://github.com/wjz-p/sona/blob/main/src/lib/features.ts): `src/lib/features.ts`
- [DOM injections](https://github.com/wjz-p/sona/blob/main/src/lib/injections.ts): `src/lib/injections.ts`
- [DOM observer](https://github.com/wjz-p/sona/blob/main/src/lib/InjectorManager.ts): `src/lib/InjectorManager.ts`

### Match intelligence

- [Match features](https://github.com/wjz-p/sona/tree/main/src/lib/features): `src/lib/features`
- [Match history](https://github.com/wjz-p/sona/blob/main/src/components/ui/MatchHistoryModal.tsx): `src/components/ui/MatchHistoryModal.tsx`
- [Match details](https://github.com/wjz-p/sona/blob/main/src/components/ui/MatchDetailModal.tsx): `src/components/ui/MatchDetailModal.tsx`
- [Game analysis](https://github.com/wjz-p/sona/blob/main/src/components/ui/GameAnalysisModal.tsx): `src/components/ui/GameAnalysisModal.tsx`
- [OP.GG loadouts](https://github.com/wjz-p/sona/blob/main/src/lib/features/opgg-build-recommendation.ts): `src/lib/features/opgg-build-recommendation.ts`
- [Loadout panel](https://github.com/wjz-p/sona/blob/main/src/components/ui/OpggBuildRecommendationPanel.tsx): `src/components/ui/OpggBuildRecommendationPanel.tsx`

### Client customization

- [Beautification features](https://github.com/wjz-p/sona/tree/main/src/lib/features/beautify-client): `src/lib/features/beautify-client`
- [Custom avatars](https://github.com/wjz-p/sona/blob/main/src/lib/features/beautify-client/custom-avatar.ts): `src/lib/features/beautify-client/custom-avatar.ts`
- [Avatar status sync](https://github.com/wjz-p/sona/blob/main/src/lib/features/beautify-client/avatar-status-sync.ts): `src/lib/features/beautify-client/avatar-status-sync.ts`

### Sona panel

- [Panel application](https://github.com/wjz-p/sona/blob/main/src/App.tsx): `src/App.tsx`
- [Tools page](https://github.com/wjz-p/sona/blob/main/src/components/pages/ToolsPage.tsx): `src/components/pages/ToolsPage.tsx`
- [Beautify page](https://github.com/wjz-p/sona/blob/main/src/components/pages/BeautifyPage.tsx): `src/components/pages/BeautifyPage.tsx`
- [Rewards page](https://github.com/wjz-p/sona/blob/main/src/components/pages/RewardsPage.tsx): `src/components/pages/RewardsPage.tsx`

### Client services

- [LCU client](https://github.com/wjz-p/sona/blob/main/src/lib/lcu.ts): `src/lib/lcu.ts`
- [Persistent settings](https://github.com/wjz-p/sona/blob/main/src/lib/store.ts): `src/lib/store.ts`
- [OP.GG data API](https://github.com/wjz-p/sona/blob/main/src/lib/opgg-api.ts): `src/lib/opgg-api.ts`
- [ARAM.GG data API](https://github.com/wjz-p/sona/blob/main/src/lib/aramgg-api.ts): `src/lib/aramgg-api.ts`
- [Game asset maps](https://github.com/wjz-p/sona/blob/main/src/lib/assets.ts): `src/lib/assets.ts`

### Other components

- **Player**
- **Pengu Loader**

## Connections

- Player → Panel application: opens panel (evidence: `README.md`)
- Pengu Loader → Plugin startup: loads plugin (evidence: `src/index.tsx`)
- Plugin startup → Feature registry: initializes (evidence: `src/index.tsx`)
- Plugin startup → DOM injections: registers (evidence: `src/index.tsx`)
- Plugin startup → Panel application: mounts (evidence: `src/index.tsx`)
- DOM injections → DOM observer: uses
- Feature registry → Match features: initializes (evidence: `src/lib/features.ts`)
- Feature registry → Beautification features: initializes (evidence: `src/lib/features.ts`)
- Player → Match history: queries matches (evidence: `README.md`)
- Match history → Match details: opens details (evidence: `src/components/ui/MatchHistoryModal.tsx`)
- Player → Game analysis: requests analysis (evidence: `README.md`)
- Match features → Game analysis: opens analysis
- Match features → OP.GG loadouts: enables
- OP.GG loadouts → Loadout panel: renders (evidence: `src/lib/features/opgg-build-recommendation.ts`)
- OP.GG loadouts → OP.GG data API: fetches builds (evidence: `src/lib/features/opgg-build-recommendation.ts`)
- OP.GG loadouts → ARAM.GG data API: fetches mode data (evidence: `src/lib/features/opgg-build-recommendation.ts`)
- OP.GG loadouts → LCU client: reads client state (evidence: `src/lib/features/opgg-build-recommendation.ts`)
- OP.GG loadouts → Persistent settings: reads settings (evidence: `src/lib/features/opgg-build-recommendation.ts`)
- Loadout panel → Game asset maps: uses asset maps (evidence: `src/components/ui/OpggBuildRecommendationPanel.tsx`)
- Beautification features → Custom avatars: includes (evidence: `src/lib/features/beautify-client/custom-avatar.ts`)
- Custom avatars → Avatar status sync: decodes status (evidence: `src/lib/features/beautify-client/custom-avatar.ts`)
- Custom avatars → LCU client: updates client (evidence: `src/lib/features/beautify-client/custom-avatar.ts`)
- Player → Beautify page: customizes client (evidence: `README.md`)
- Beautify page → Persistent settings: reads settings (evidence: `src/components/pages/BeautifyPage.tsx`)
- Panel application → Tools page: routes to (evidence: `src/App.tsx`)
- Panel application → Beautify page: routes to (evidence: `src/App.tsx`)
- Panel application → Rewards page: routes to (evidence: `src/App.tsx`)
- Player → Rewards page: claims rewards (evidence: `README.md`)
- Tools page → Match history: opens history (evidence: `src/components/pages/ToolsPage.tsx`)
- Tools page → LCU client: uses client API (evidence: `src/components/pages/ToolsPage.tsx`)
- Plugin startup → LCU client: binds context (evidence: `src/index.tsx`)
- Plugin startup → Game asset maps: initializes maps (evidence: `src/index.tsx`)
