# maeneko/senamneziawg architecture

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

- Interactive diagram: https://gitdiagram.com/maeneko/senamneziawg
- Repository: https://github.com/maeneko/senamneziawg

## Overview

SenAWG is a cross-platform Electron client for WireGuard and AmneziaWG VPNs. A user imports a VPN or SenAmnesia link, the main process parses it and stores tunnel or subscription data, then the tunnel manager connects through a platform-specific privileged backend; state and logs return to the renderer. The README also documents profile/subscription management, diagnostics, updates, setup and uninstall. Several platform and UI modules were not sampled, so their documented capabilities are shown without speculative call chains.

Main entry points: [`src/main/index.ts`](https://github.com/maeneko/senamneziawg/blob/master/src/main/index.ts) (Electron main), [`src/renderer/src/App.tsx`](https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/App.tsx) (SenAWG window), [`src/main/sen/manager.ts`](https://github.com/maeneko/senamneziawg/blob/master/src/main/sen/manager.ts) (Subscription manager), [`src/main/tunnel/macosScriptController.ts`](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/macosScriptController.ts) (macOS controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_renderer["SenAWG window<br/>[App.tsx]"]
  node_preload["IPC bridge<br/>[index.ts]"]
  node_tunnel_views["Tunnel views<br/>[TunnelViews.tsx]"]
  node_profile_view["Profile view<br/>[ProfileView.tsx]"]
  node_settings_view["Settings view<br/>[SettingsView.tsx]"]
  node_logs_view["Logs view<br/>[LogsView.tsx]"]
end

subgraph group_app["Application services"]
  node_main["Electron main<br/>[index.ts]"]
  node_vpn_links["VPN link parser<br/>[vpnLink.ts]"]
  node_sen_links["Sen link parser<br/>[senLink.ts]"]
  node_wg_config["Tunnel config<br/>[wgConfig.ts]"]
  node_wg_conf["Config conversion<br/>[wgConf.ts]"]
  node_sen_manager["Subscription manager<br/>[manager.ts]"]
  node_sen_client["Sen API client<br/>[client.ts]"]
  node_store[("Tunnel store<br/>[store.ts]")]
  node_sen_store[("Subscription store<br/>[store.ts]")]
  node_logger["Application logger<br/>[logger.ts]"]
  node_updater["Update service<br/>[updater.ts]"]
end

subgraph group_tunnel["Tunnel runtime"]
  node_tunnel_manager["Tunnel manager<br/>[manager.ts]"]
  node_controller["Controller interface"]
  node_awg_version["Protocol versions<br/>[awgVersion.ts]"]
  node_uapi["UAPI transport<br/>[uapi.ts]"]
  node_uapi_config["UAPI config<br/>[uapiConfig.ts]"]
  node_mac_controller["macOS controller"]
  node_mac_service["macOS service<br/>[service.ts]"]
end

subgraph group_priv["Privileged helpers"]
  node_win_client["Windows helper client<br/>[helperClient.ts]"]
  node_win_protocol["Helper protocol<br/>[protocol.ts]"]
  node_go_helper["Platform helper<br/>[dispatch.go]"]
  node_engine["AmneziaWG engine"]
end

node_user(("User"))
node_system["Host operating system"]
node_sen_service["SenAmnesia service"]

node_user -->|"uses"| node_renderer
node_renderer -->|"renders"| node_tunnel_views
node_renderer -->|"renders"| node_profile_view
node_renderer -->|"renders"| node_settings_view
node_renderer -->|"renders"| node_logs_view
node_renderer -.->|"invokes bridge"| node_preload
node_preload -.->|"sends IPC"| node_main
node_main -->|"parses VPN links"| node_vpn_links
node_main -->|"checks Sen links"| node_sen_links
node_main -->|"parses VPN config"| node_wg_config
node_main -->|"coordinates subscriptions"| node_sen_manager
node_main -->|"manages tunnels"| node_tunnel_manager
node_main -->|"reads and removes"| node_store
node_main -.->|"logs events"| node_logger
node_sen_manager -->|"decodes links"| node_sen_links
node_sen_manager -.->|"requests service"| node_sen_client
node_sen_manager -->|"reads and updates"| node_store
node_sen_manager -->|"reads subscriptions"| node_sen_store
node_sen_manager -.->|"applies tunnel config"| node_wg_config
node_tunnel_manager -->|"loads tunnels"| node_store
node_tunnel_manager -->|"controls tunnel"| node_controller
node_tunnel_manager -->|"detects protocol"| node_awg_version
node_mac_controller -->|"implements operations"| node_controller
node_mac_controller -->|"requests stats"| node_uapi
node_mac_controller -->|"builds tunnel config"| node_uapi_config
node_mac_controller -->|"detects protocol"| node_awg_version
node_mac_controller -->|"runs privileged commands"| node_system
node_mac_service -->|"installs service"| node_system
node_win_client -->|"encodes requests"| node_win_protocol
node_win_client -->|"requests over pipe"| node_go_helper
node_go_helper -.->|"controls networking"| node_system
node_system -.->|"runs VPN engine"| node_engine
node_sen_client -.->|"calls service"| node_sen_service
node_main -.->|"handles updates"| node_updater
node_renderer -.->|"shows update state"| node_updater
node_wg_config -.->|"normalizes config"| node_wg_conf

click node_renderer "https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/App.tsx"
click node_preload "https://github.com/maeneko/senamneziawg/blob/master/src/preload/index.ts"
click node_tunnel_views "https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/TunnelViews.tsx"
click node_profile_view "https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/ProfileView.tsx"
click node_settings_view "https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/SettingsView.tsx"
click node_logs_view "https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/LogsView.tsx"
click node_main "https://github.com/maeneko/senamneziawg/blob/master/src/main/index.ts"
click node_vpn_links "https://github.com/maeneko/senamneziawg/blob/master/src/main/config/vpnLink.ts"
click node_sen_links "https://github.com/maeneko/senamneziawg/blob/master/src/main/config/senLink.ts"
click node_wg_config "https://github.com/maeneko/senamneziawg/blob/master/src/main/config/wgConfig.ts"
click node_wg_conf "https://github.com/maeneko/senamneziawg/blob/master/src/main/config/wgConf.ts"
click node_sen_manager "https://github.com/maeneko/senamneziawg/blob/master/src/main/sen/manager.ts"
click node_sen_client "https://github.com/maeneko/senamneziawg/blob/master/src/main/sen/client.ts"
click node_store "https://github.com/maeneko/senamneziawg/blob/master/src/main/store.ts"
click node_sen_store "https://github.com/maeneko/senamneziawg/blob/master/src/main/sen/store.ts"
click node_logger "https://github.com/maeneko/senamneziawg/blob/master/src/main/logger.ts"
click node_updater "https://github.com/maeneko/senamneziawg/blob/master/src/main/update/updater.ts"
click node_tunnel_manager "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/manager.ts"
click node_controller "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/TunnelController.ts"
click node_awg_version "https://github.com/maeneko/senamneziawg/blob/master/src/shared/awgVersion.ts"
click node_uapi "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/uapi.ts"
click node_uapi_config "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/uapiConfig.ts"
click node_mac_controller "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/macosScriptController.ts"
click node_mac_service "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/macos/service.ts"
click node_win_client "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/windows/helperClient.ts"
click node_win_protocol "https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/windows/protocol.ts"
click node_go_helper "https://github.com/maeneko/senamneziawg/blob/master/helper/dispatch.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_renderer,node_preload,node_tunnel_views,node_profile_view,node_settings_view,node_logs_view,node_user toneBlue
class node_main,node_vpn_links,node_sen_links,node_wg_config,node_wg_conf,node_sen_manager,node_sen_client,node_store,node_sen_store,node_logger,node_updater toneAmber
class node_tunnel_manager,node_controller,node_awg_version,node_uapi,node_uapi_config,node_mac_controller,node_mac_service toneMint
class node_win_client,node_win_protocol,node_go_helper,node_engine toneRose
class node_system,node_sen_service toneIndigo
```

## Components

### User interface

- [SenAWG window](https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [IPC bridge](https://github.com/maeneko/senamneziawg/blob/master/src/preload/index.ts): `src/preload/index.ts`
- [Tunnel views](https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/TunnelViews.tsx): `src/renderer/src/components/TunnelViews.tsx`
- [Profile view](https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/ProfileView.tsx): `src/renderer/src/components/ProfileView.tsx`
- [Settings view](https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/SettingsView.tsx): `src/renderer/src/components/SettingsView.tsx`
- [Logs view](https://github.com/maeneko/senamneziawg/blob/master/src/renderer/src/components/LogsView.tsx): `src/renderer/src/components/LogsView.tsx`

### Application services

- [Electron main](https://github.com/maeneko/senamneziawg/blob/master/src/main/index.ts): `src/main/index.ts`
- [VPN link parser](https://github.com/maeneko/senamneziawg/blob/master/src/main/config/vpnLink.ts): `src/main/config/vpnLink.ts`
- [Sen link parser](https://github.com/maeneko/senamneziawg/blob/master/src/main/config/senLink.ts): `src/main/config/senLink.ts`
- [Tunnel config](https://github.com/maeneko/senamneziawg/blob/master/src/main/config/wgConfig.ts): `src/main/config/wgConfig.ts`
- [Config conversion](https://github.com/maeneko/senamneziawg/blob/master/src/main/config/wgConf.ts): `src/main/config/wgConf.ts`
- [Subscription manager](https://github.com/maeneko/senamneziawg/blob/master/src/main/sen/manager.ts): `src/main/sen/manager.ts`
- [Sen API client](https://github.com/maeneko/senamneziawg/blob/master/src/main/sen/client.ts): `src/main/sen/client.ts`
- [Tunnel store](https://github.com/maeneko/senamneziawg/blob/master/src/main/store.ts): `src/main/store.ts`
- [Subscription store](https://github.com/maeneko/senamneziawg/blob/master/src/main/sen/store.ts): `src/main/sen/store.ts`
- [Application logger](https://github.com/maeneko/senamneziawg/blob/master/src/main/logger.ts): `src/main/logger.ts`
- [Update service](https://github.com/maeneko/senamneziawg/blob/master/src/main/update/updater.ts): `src/main/update/updater.ts`

### Tunnel runtime

- [Tunnel manager](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/manager.ts): `src/main/tunnel/manager.ts`
- [Controller interface](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/TunnelController.ts): `src/main/tunnel/TunnelController.ts`
- [Protocol versions](https://github.com/maeneko/senamneziawg/blob/master/src/shared/awgVersion.ts): `src/shared/awgVersion.ts`
- [UAPI transport](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/uapi.ts): `src/main/tunnel/uapi.ts`
- [UAPI config](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/uapiConfig.ts): `src/main/tunnel/uapiConfig.ts`
- [macOS controller](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/macosScriptController.ts): `src/main/tunnel/macosScriptController.ts`
- [macOS service](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/macos/service.ts): `src/main/tunnel/macos/service.ts`

### Privileged helpers

- [Windows helper client](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/windows/helperClient.ts): `src/main/tunnel/windows/helperClient.ts`
- [Helper protocol](https://github.com/maeneko/senamneziawg/blob/master/src/main/tunnel/windows/protocol.ts): `src/main/tunnel/windows/protocol.ts`
- [Platform helper](https://github.com/maeneko/senamneziawg/blob/master/helper/dispatch.go): `helper/dispatch.go`
- **AmneziaWG engine**

### Other components

- **User**
- **Host operating system**
- **SenAmnesia service**

## Connections

- User → SenAWG window: uses
- SenAWG window → Tunnel views: renders (evidence: `src/renderer/src/App.tsx`)
- SenAWG window → Profile view: renders (evidence: `src/renderer/src/App.tsx`)
- SenAWG window → Settings view: renders (evidence: `src/renderer/src/App.tsx`)
- SenAWG window → Logs view: renders (evidence: `src/renderer/src/App.tsx`)
- SenAWG window → IPC bridge: invokes bridge
- IPC bridge → Electron main: sends IPC
- Electron main → VPN link parser: parses VPN links (evidence: `src/main/index.ts`)
- Electron main → Sen link parser: checks Sen links (evidence: `src/main/index.ts`)
- Electron main → Tunnel config: parses VPN config (evidence: `src/main/index.ts`)
- Electron main → Subscription manager: coordinates subscriptions (evidence: `src/main/index.ts`)
- Electron main → Tunnel manager: manages tunnels (evidence: `src/main/index.ts`)
- Electron main → Tunnel store: reads and removes (evidence: `src/main/index.ts`)
- Electron main → Application logger: logs events (evidence: `src/main/index.ts`)
- Subscription manager → Sen link parser: decodes links (evidence: `src/main/sen/manager.ts`)
- Subscription manager → Sen API client: requests service (evidence: `src/main/sen/manager.ts`)
- Subscription manager → Tunnel store: reads and updates (evidence: `src/main/sen/manager.ts`)
- Subscription manager → Subscription store: reads subscriptions (evidence: `src/main/sen/manager.ts`)
- Subscription manager → Tunnel config: applies tunnel config
- Tunnel manager → Tunnel store: loads tunnels (evidence: `src/main/tunnel/manager.ts`)
- Tunnel manager → Controller interface: controls tunnel (evidence: `src/main/tunnel/manager.ts`)
- Tunnel manager → Protocol versions: detects protocol (evidence: `src/main/tunnel/manager.ts`)
- macOS controller → Controller interface: implements operations (evidence: `src/main/tunnel/macosScriptController.ts`)
- macOS controller → UAPI transport: requests stats (evidence: `src/main/tunnel/macosScriptController.ts`)
- macOS controller → UAPI config: builds tunnel config (evidence: `src/main/tunnel/macosScriptController.ts`)
- macOS controller → Protocol versions: detects protocol (evidence: `src/main/tunnel/macosScriptController.ts`)
- macOS controller → Host operating system: runs privileged commands (evidence: `src/main/tunnel/macosScriptController.ts`)
- macOS service → Host operating system: installs service (evidence: `src/main/tunnel/macos/service.ts`)
- Windows helper client → Helper protocol: encodes requests (evidence: `src/main/tunnel/windows/helperClient.ts`)
- Windows helper client → Platform helper: requests over pipe (evidence: `src/main/tunnel/windows/helperClient.ts`)
- Platform helper → Host operating system: controls networking
- Host operating system → AmneziaWG engine: runs VPN engine
- Sen API client → SenAmnesia service: calls service
- Electron main → Update service: handles updates
- SenAWG window → Update service: shows update state
- Tunnel config → Config conversion: normalizes config (evidence: `src/main/config/wgConf.ts`)
