# highskai/lotus architecture

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

- Interactive diagram: https://gitdiagram.com/highskai/lotus
- Repository: https://github.com/highskai/lotus

## Overview

LOTUS is a Windows desktop app for encrypted DNS and bring-your-own-server VPN sessions. Users choose LOTUS or SHADOW, configure a resolver or server and routing options, then connect; the privileged service validates and runs the session, applying Windows DNS and firewall protections and reporting verified status. The graph also captures the console, leak checks, usage, server import, tray, and updates. Edges reflect README statements and shown source/index references; several UI and service subsystems are documented but not sampled in detail.

Main entry points: [`app/src/App.tsx`](https://github.com/highskai/lotus/blob/main/app/src/App.tsx) (Desktop shell), [`crates/lotus-service/src/controller.rs`](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/controller.rs) (Session controller), [`app/src-tauri/src/commands.rs`](https://github.com/highskai/lotus/blob/main/app/src-tauri/src/commands.rs) (Desktop commands), [`crates/lotus-service/src/engine.rs`](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/engine.rs) (sing-box supervisor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_app["Desktop shell<br/>[App.tsx]"]
  node_home["Mode controls<br/>[Home.tsx]"]
  node_servers["Server management<br/>[Servers.tsx]"]
  node_editor["Server editor<br/>[ServerEditor.tsx]"]
  node_settings["Connection settings<br/>[Settings.tsx]"]
  node_console["Live console<br/>[Console.tsx]"]
  node_tools["Privacy checks<br/>[Tools.tsx]"]
  node_usage["Usage history<br/>[Usage.tsx]"]
  node_updates["Update controls<br/>[Updates.tsx]"]
  node_tauri["Desktop commands<br/>[commands.rs]"]
  node_tray["System tray<br/>[tray.rs]"]
  node_appstore[("App settings store<br/>[store.rs]")]
  node_client["Service client<br/>[service_client.rs]"]
end

subgraph group_core["Profiles and configuration"]
  node_profiles["Profile model<br/>[model.rs]"]
  node_import["Profile import<br/>[import.rs]"]
  node_validation["Security validation<br/>[validate.rs]"]
  node_config["Engine config<br/>[singbox.rs]"]
end

subgraph group_service["Session service"]
  node_svcmain["Service entry<br/>[main.rs]"]
  node_ipc["Service IPC<br/>[ipc_server.rs]"]
  node_controller["Session controller<br/>[controller.rs]"]
  node_session["Session lifecycle<br/>[session.rs]"]
  node_engine["sing-box supervisor<br/>[engine.rs]"]
  node_probe["Connectivity probes<br/>[probe.rs]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.rs]"]
  node_verify["Server verification<br/>[verify.rs]"]
  node_service_state[("Session state store<br/>[state.rs]")]
  node_accounting["Usage accounting<br/>[usage.rs]"]
end

subgraph group_windows["Windows protection"]
  node_adapters["DNS adapters<br/>[adapters.rs]"]
  node_wfp["Firewall guards<br/>[wfp.rs]"]
  node_job["Engine job control<br/>[job.rs]"]
end

node_user(("User"))
node_server{{"User-owned server"}}
node_resolver{{"Encrypted resolver"}}
node_internet(("Internet"))

node_user -->|"uses"| node_app
node_app -->|"shows"| node_home
node_app -->|"shows"| node_servers
node_app -->|"shows"| node_editor
node_app -->|"shows"| node_settings
node_app -->|"shows"| node_console
node_app -->|"shows"| node_tools
node_app -->|"shows"| node_usage
node_app -->|"shows"| node_updates
node_home -.->|"invokes"| node_tauri
node_servers -.->|"manages profiles"| node_tauri
node_editor -.->|"imports profiles"| node_tauri
node_settings -.->|"saves options"| node_tauri
node_tauri -->|"requests service"| node_client
node_tauri -->|"persists settings"| node_appstore
node_tray -->|"dispatches actions"| node_tauri
node_client -->|"exchanges messages"| node_ipc
node_profiles -->|"validates"| node_validation
node_import -->|"parses into"| node_profiles
node_config -->|"generates from"| node_profiles
node_svcmain -->|"starts"| node_controller
node_svcmain -->|"starts"| node_ipc
node_ipc -.->|"dispatches commands"| node_controller
node_controller -->|"starts sessions"| node_session
node_controller -->|"supervises"| node_engine
node_controller -->|"stores session state"| node_service_state
node_controller -->|"sets DNS"| node_adapters
node_controller -->|"configures guards"| node_wfp
node_session -->|"runs engine"| node_engine
node_session -->|"checks data path"| node_probe
node_engine -->|"controls process"| node_job
node_accounting -->|"reads session totals"| node_controller
node_diagnostics -.->|"provides diagnostics"| node_svcmain
node_verify -.->|"checks server"| node_probe
node_engine -->|"sends encrypted DNS"| node_resolver
node_engine -->|"tunnels traffic"| node_server
node_server -->|"forwards traffic"| node_internet

click node_app "https://github.com/highskai/lotus/blob/main/app/src/App.tsx"
click node_home "https://github.com/highskai/lotus/blob/main/app/src/screens/Home.tsx"
click node_servers "https://github.com/highskai/lotus/blob/main/app/src/screens/Servers.tsx"
click node_editor "https://github.com/highskai/lotus/blob/main/app/src/screens/ServerEditor.tsx"
click node_settings "https://github.com/highskai/lotus/blob/main/app/src/screens/Settings.tsx"
click node_console "https://github.com/highskai/lotus/blob/main/app/src/screens/Console.tsx"
click node_tools "https://github.com/highskai/lotus/blob/main/app/src/screens/Tools.tsx"
click node_usage "https://github.com/highskai/lotus/blob/main/app/src/screens/Usage.tsx"
click node_updates "https://github.com/highskai/lotus/blob/main/app/src/screens/Updates.tsx"
click node_tauri "https://github.com/highskai/lotus/blob/main/app/src-tauri/src/commands.rs"
click node_tray "https://github.com/highskai/lotus/blob/main/app/src-tauri/src/tray.rs"
click node_appstore "https://github.com/highskai/lotus/blob/main/app/src-tauri/src/store.rs"
click node_client "https://github.com/highskai/lotus/blob/main/app/src-tauri/src/service_client.rs"
click node_profiles "https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/model.rs"
click node_import "https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/import.rs"
click node_validation "https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/validate.rs"
click node_config "https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/singbox.rs"
click node_svcmain "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/main.rs"
click node_ipc "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/ipc_server.rs"
click node_controller "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/controller.rs"
click node_session "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/session.rs"
click node_engine "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/engine.rs"
click node_probe "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/probe.rs"
click node_diagnostics "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/diagnostics.rs"
click node_verify "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/verify.rs"
click node_service_state "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/state.rs"
click node_accounting "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/usage.rs"
click node_adapters "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/win/adapters.rs"
click node_wfp "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/win/wfp.rs"
click node_job "https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/win/job.rs"

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_app,node_home,node_servers,node_editor,node_settings,node_console,node_tools,node_usage,node_updates,node_tauri,node_tray,node_appstore,node_client,node_user,node_server toneBlue
class node_profiles,node_import,node_validation,node_config toneAmber
class node_svcmain,node_ipc,node_controller,node_session,node_engine,node_probe,node_diagnostics,node_verify,node_service_state,node_accounting toneMint
class node_adapters,node_wfp,node_job toneRose
class node_resolver,node_internet toneIndigo
```

## Components

### Desktop experience

- [Desktop shell](https://github.com/highskai/lotus/blob/main/app/src/App.tsx): `app/src/App.tsx`
- [Mode controls](https://github.com/highskai/lotus/blob/main/app/src/screens/Home.tsx): `app/src/screens/Home.tsx`
- [Server management](https://github.com/highskai/lotus/blob/main/app/src/screens/Servers.tsx): `app/src/screens/Servers.tsx`
- [Server editor](https://github.com/highskai/lotus/blob/main/app/src/screens/ServerEditor.tsx): `app/src/screens/ServerEditor.tsx`
- [Connection settings](https://github.com/highskai/lotus/blob/main/app/src/screens/Settings.tsx): `app/src/screens/Settings.tsx`
- [Live console](https://github.com/highskai/lotus/blob/main/app/src/screens/Console.tsx): `app/src/screens/Console.tsx`
- [Privacy checks](https://github.com/highskai/lotus/blob/main/app/src/screens/Tools.tsx): `app/src/screens/Tools.tsx`
- [Usage history](https://github.com/highskai/lotus/blob/main/app/src/screens/Usage.tsx): `app/src/screens/Usage.tsx`
- [Update controls](https://github.com/highskai/lotus/blob/main/app/src/screens/Updates.tsx): `app/src/screens/Updates.tsx`
- [Desktop commands](https://github.com/highskai/lotus/blob/main/app/src-tauri/src/commands.rs): `app/src-tauri/src/commands.rs`
- [System tray](https://github.com/highskai/lotus/blob/main/app/src-tauri/src/tray.rs): `app/src-tauri/src/tray.rs`
- [App settings store](https://github.com/highskai/lotus/blob/main/app/src-tauri/src/store.rs): `app/src-tauri/src/store.rs`
- [Service client](https://github.com/highskai/lotus/blob/main/app/src-tauri/src/service_client.rs): `app/src-tauri/src/service_client.rs`

### Profiles and configuration

- [Profile model](https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/model.rs): `crates/lotus-core/src/model.rs`
- [Profile import](https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/import.rs): `crates/lotus-core/src/import.rs`
- [Security validation](https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/validate.rs): `crates/lotus-core/src/validate.rs`
- [Engine config](https://github.com/highskai/lotus/blob/main/crates/lotus-core/src/singbox.rs): `crates/lotus-core/src/singbox.rs`

### Session service

- [Service entry](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/main.rs): `crates/lotus-service/src/main.rs`
- [Service IPC](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/ipc_server.rs): `crates/lotus-service/src/ipc_server.rs`
- [Session controller](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/controller.rs): `crates/lotus-service/src/controller.rs`
- [Session lifecycle](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/session.rs): `crates/lotus-service/src/session.rs`
- [sing-box supervisor](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/engine.rs): `crates/lotus-service/src/engine.rs`
- [Connectivity probes](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/probe.rs): `crates/lotus-service/src/probe.rs`
- [Diagnostics](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/diagnostics.rs): `crates/lotus-service/src/diagnostics.rs`
- [Server verification](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/verify.rs): `crates/lotus-service/src/verify.rs`
- [Session state store](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/state.rs): `crates/lotus-service/src/state.rs`
- [Usage accounting](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/usage.rs): `crates/lotus-service/src/usage.rs`

### Windows protection

- [DNS adapters](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/win/adapters.rs): `crates/lotus-service/src/win/adapters.rs`
- [Firewall guards](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/win/wfp.rs): `crates/lotus-service/src/win/wfp.rs`
- [Engine job control](https://github.com/highskai/lotus/blob/main/crates/lotus-service/src/win/job.rs): `crates/lotus-service/src/win/job.rs`

### Other components

- **User**
- **User-owned server**
- **Encrypted resolver**
- **Internet**

## Connections

- User → Desktop shell: uses (evidence: `README.md`)
- Desktop shell → Mode controls: shows (evidence: `app/src/App.tsx`)
- Desktop shell → Server management: shows (evidence: `app/src/App.tsx`)
- Desktop shell → Server editor: shows (evidence: `app/src/App.tsx`)
- Desktop shell → Connection settings: shows (evidence: `app/src/App.tsx`)
- Desktop shell → Live console: shows (evidence: `app/src/App.tsx`)
- Desktop shell → Privacy checks: shows (evidence: `app/src/App.tsx`)
- Desktop shell → Usage history: shows (evidence: `app/src/App.tsx`)
- Desktop shell → Update controls: shows (evidence: `app/src/App.tsx`)
- Mode controls → Desktop commands: invokes
- Server management → Desktop commands: manages profiles
- Server editor → Desktop commands: imports profiles
- Connection settings → Desktop commands: saves options
- Desktop commands → Service client: requests service (evidence: `app/src-tauri/src/commands.rs`)
- Desktop commands → App settings store: persists settings (evidence: `app/src-tauri/src/commands.rs`)
- System tray → Desktop commands: dispatches actions (evidence: `app/src-tauri/src/tray.rs`)
- Service client → Service IPC: exchanges messages (evidence: `README.md`)
- Profile model → Security validation: validates (evidence: `crates/lotus-core/src/validate.rs`)
- Profile import → Profile model: parses into (evidence: `crates/lotus-core/src/import.rs`)
- Engine config → Profile model: generates from (evidence: `crates/lotus-core/src/singbox.rs`)
- Service entry → Session controller: starts (evidence: `crates/lotus-service/src/main.rs`)
- Service entry → Service IPC: starts (evidence: `crates/lotus-service/src/main.rs`)
- Service IPC → Session controller: dispatches commands
- Session controller → Session lifecycle: starts sessions (evidence: `crates/lotus-service/src/controller.rs`)
- Session controller → sing-box supervisor: supervises (evidence: `crates/lotus-service/src/controller.rs`)
- Session controller → Session state store: stores session state (evidence: `crates/lotus-service/src/controller.rs`)
- Session controller → DNS adapters: sets DNS (evidence: `crates/lotus-service/src/controller.rs`)
- Session controller → Firewall guards: configures guards (evidence: `crates/lotus-service/src/controller.rs`)
- Session lifecycle → sing-box supervisor: runs engine (evidence: `crates/lotus-service/src/session.rs`)
- Session lifecycle → Connectivity probes: checks data path (evidence: `crates/lotus-service/src/session.rs`)
- sing-box supervisor → Engine job control: controls process (evidence: `crates/lotus-service/src/engine.rs`)
- Usage accounting → Session controller: reads session totals (evidence: `crates/lotus-service/src/usage.rs`)
- Diagnostics → Service entry: provides diagnostics (evidence: `crates/lotus-service/src/main.rs`)
- Server verification → Connectivity probes: checks server
- sing-box supervisor → Encrypted resolver: sends encrypted DNS (evidence: `README.md`)
- sing-box supervisor → User-owned server: tunnels traffic (evidence: `README.md`)
- User-owned server → Internet: forwards traffic (evidence: `README.md`)
