# dododook/flowz architecture

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

- Interactive diagram: https://gitdiagram.com/dododook/flowz
- Repository: https://github.com/dododook/flowz

## Overview

FlowZ is a cross-platform sing-box proxy client. Users add servers directly or import subscriptions, configure routing and proxy mode, then enable the proxy; the desktop UI sends requests to the Electron main process, which manages the sing-box runtime and operating-system integration. Separate product branches handle rule resources, mesh networking, live connection/statistics views, updates, and diagnostics. Relationships for unsampled subsystems are included only where the README documents the capability; the graph does not imply unverified internal call chains.

Main entry points: [`src/main/services/ProxyManager.ts`](https://github.com/dododook/flowz/blob/main/src/main/services/ProxyManager.ts) (Proxy manager), [`src/renderer/ipc/api-client.ts`](https://github.com/dododook/flowz/blob/main/src/renderer/ipc/api-client.ts) (Renderer API), [`src/main/ipc/handlers`](https://github.com/dododook/flowz/tree/main/src/main/ipc/handlers) (IPC handlers), [`src/main/index.ts`](https://github.com/dododook/flowz/blob/main/src/main/index.ts) (Electron main)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_renderer["App and pages<br/>[App.tsx]"]
  node_renderer_api["Renderer API<br/>[api-client.ts]"]
end

subgraph group_control["Main-process control"]
  node_main["Electron main<br/>[index.ts]"]
  node_ipc["IPC handlers"]
  node_config["Configuration<br/>[ConfigManager.ts]"]
end

subgraph group_routing["Routing and nodes"]
  node_server_import["Server import<br/>[ProtocolParser.ts]"]
  node_subscriptions["Subscriptions"]
  node_rules["Routing rules"]
  node_mesh["Mesh services<br/>[WarpService.ts]"]
  node_rule_catalog["Rule resources"]
end

subgraph group_runtime["Proxy runtime"]
  node_proxy["Proxy manager<br/>[ProxyManager.ts]"]
  node_singbox["sing-box core"]
  node_sysproxy["System proxy"]
  node_sysdns["System DNS"]
  node_privilege["Privileged helpers<br/>[HelperManager.ts]"]
end

subgraph group_operations["Operations and insight"]
  node_stats["Live statistics<br/>[stats-worker.ts]"]
  node_logs["Logs<br/>[LogManager.ts]"]
  node_diagnostics["Diagnostics"]
  node_updates["Application updates<br/>[UpdateService.ts]"]
  node_resources["Core and assets<br/>[ResourceManager.ts]"]
end

node_user(("User"))

node_user -->|"configures"| node_renderer
node_renderer -->|"requests"| node_renderer_api
node_renderer_api -->|"invokes"| node_ipc
node_ipc -.->|"reads and saves"| node_config
node_ipc -.->|"controls"| node_proxy
node_main -->|"manages"| node_proxy
node_proxy -->|"starts and controls"| node_singbox
node_proxy -->|"sets system proxy"| node_sysproxy
node_proxy -->|"manages DNS"| node_sysdns
node_proxy -->|"uses helper"| node_privilege
node_user -->|"adds servers"| node_server_import
node_user -->|"imports subscriptions"| node_subscriptions
node_subscriptions -.->|"updates nodes"| node_config
node_user -->|"configures routing"| node_rules
node_user -->|"manages rule sets"| node_rule_catalog
node_user -->|"sets up mesh"| node_mesh
node_singbox -->|"provides runtime data"| node_stats
node_renderer_api -.->|"requests statistics"| node_stats
node_user -->|"views logs"| node_logs
node_user -->|"exports report"| node_diagnostics
node_user -->|"updates app"| node_updates
node_main -->|"manages assets"| node_resources
node_singbox -->|"loads rule sets"| node_rule_catalog

click node_renderer "https://github.com/dododook/flowz/blob/main/src/renderer/App.tsx"
click node_renderer_api "https://github.com/dododook/flowz/blob/main/src/renderer/ipc/api-client.ts"
click node_main "https://github.com/dododook/flowz/blob/main/src/main/index.ts"
click node_ipc "https://github.com/dododook/flowz/tree/main/src/main/ipc/handlers"
click node_config "https://github.com/dododook/flowz/blob/main/src/main/services/ConfigManager.ts"
click node_proxy "https://github.com/dododook/flowz/blob/main/src/main/services/ProxyManager.ts"
click node_sysproxy "https://github.com/dododook/flowz/blob/main/src/main/services/SystemProxyManager.ts"
click node_sysdns "https://github.com/dododook/flowz/blob/main/src/main/services/SystemDnsManager.ts"
click node_privilege "https://github.com/dododook/flowz/blob/main/src/main/services/HelperManager.ts"
click node_server_import "https://github.com/dododook/flowz/blob/main/src/main/services/ProtocolParser.ts"
click node_subscriptions "https://github.com/dododook/flowz/blob/main/src/main/services/SubscriptionService.ts"
click node_rules "https://github.com/dododook/flowz/blob/main/src/main/services/RuleResourceManager.ts"
click node_mesh "https://github.com/dododook/flowz/blob/main/src/main/services/WarpService.ts"
click node_stats "https://github.com/dododook/flowz/blob/main/src/main/workers/stats-worker.ts"
click node_logs "https://github.com/dododook/flowz/blob/main/src/main/services/LogManager.ts"
click node_diagnostics "https://github.com/dododook/flowz/blob/main/src/main/services/DiagnosticService.ts"
click node_updates "https://github.com/dododook/flowz/blob/main/src/main/services/UpdateService.ts"
click node_resources "https://github.com/dododook/flowz/blob/main/src/main/services/ResourceManager.ts"
click node_rule_catalog "https://github.com/dododook/flowz/blob/main/src/main/services/RuleResourceManager.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_renderer,node_renderer_api,node_user toneBlue
class node_main,node_ipc,node_config toneAmber
class node_server_import,node_subscriptions,node_rules,node_mesh,node_rule_catalog toneMint
class node_proxy,node_singbox,node_sysproxy,node_sysdns,node_privilege toneRose
class node_stats,node_logs,node_diagnostics,node_updates,node_resources toneIndigo
```

## Components

### Desktop interface

- [App and pages](https://github.com/dododook/flowz/blob/main/src/renderer/App.tsx): `src/renderer/App.tsx`
- [Renderer API](https://github.com/dododook/flowz/blob/main/src/renderer/ipc/api-client.ts): `src/renderer/ipc/api-client.ts`

### Main-process control

- [Electron main](https://github.com/dododook/flowz/blob/main/src/main/index.ts): `src/main/index.ts`
- [IPC handlers](https://github.com/dododook/flowz/tree/main/src/main/ipc/handlers): `src/main/ipc/handlers`
- [Configuration](https://github.com/dododook/flowz/blob/main/src/main/services/ConfigManager.ts): `src/main/services/ConfigManager.ts`

### Routing and nodes

- [Server import](https://github.com/dododook/flowz/blob/main/src/main/services/ProtocolParser.ts): `src/main/services/ProtocolParser.ts`
- [Subscriptions](https://github.com/dododook/flowz/blob/main/src/main/services/SubscriptionService.ts): `src/main/services/SubscriptionService.ts`
- [Routing rules](https://github.com/dododook/flowz/blob/main/src/main/services/RuleResourceManager.ts): `src/main/services/RuleResourceManager.ts`
- [Mesh services](https://github.com/dododook/flowz/blob/main/src/main/services/WarpService.ts): `src/main/services/WarpService.ts`
- [Rule resources](https://github.com/dododook/flowz/blob/main/src/main/services/RuleResourceManager.ts): `src/main/services/RuleResourceManager.ts`

### Proxy runtime

- [Proxy manager](https://github.com/dododook/flowz/blob/main/src/main/services/ProxyManager.ts): `src/main/services/ProxyManager.ts`
- **sing-box core**
- [System proxy](https://github.com/dododook/flowz/blob/main/src/main/services/SystemProxyManager.ts): `src/main/services/SystemProxyManager.ts`
- [System DNS](https://github.com/dododook/flowz/blob/main/src/main/services/SystemDnsManager.ts): `src/main/services/SystemDnsManager.ts`
- [Privileged helpers](https://github.com/dododook/flowz/blob/main/src/main/services/HelperManager.ts): `src/main/services/HelperManager.ts`

### Operations and insight

- [Live statistics](https://github.com/dododook/flowz/blob/main/src/main/workers/stats-worker.ts): `src/main/workers/stats-worker.ts`
- [Logs](https://github.com/dododook/flowz/blob/main/src/main/services/LogManager.ts): `src/main/services/LogManager.ts`
- [Diagnostics](https://github.com/dododook/flowz/blob/main/src/main/services/DiagnosticService.ts): `src/main/services/DiagnosticService.ts`
- [Application updates](https://github.com/dododook/flowz/blob/main/src/main/services/UpdateService.ts): `src/main/services/UpdateService.ts`
- [Core and assets](https://github.com/dododook/flowz/blob/main/src/main/services/ResourceManager.ts): `src/main/services/ResourceManager.ts`

### Other components

- **User**

## Connections

- User → App and pages: configures (evidence: `README.md`)
- App and pages → Renderer API: requests (evidence: `src/renderer/App.tsx`)
- Renderer API → IPC handlers: invokes (evidence: `src/renderer/ipc/api-client.ts`)
- IPC handlers → Configuration: reads and saves
- IPC handlers → Proxy manager: controls (evidence: `src/main/ipc/handlers/helper-handlers.ts`)
- Electron main → Proxy manager: manages (evidence: `src/main/index.ts`)
- Proxy manager → sing-box core: starts and controls (evidence: `README.md`)
- Proxy manager → System proxy: sets system proxy (evidence: `src/main/services/ProxyManager.ts`)
- Proxy manager → System DNS: manages DNS (evidence: `src/main/services/ProxyManager.ts`)
- Proxy manager → Privileged helpers: uses helper (evidence: `src/main/services/ProxyManager.ts`)
- User → Server import: adds servers (evidence: `README.md`)
- User → Subscriptions: imports subscriptions (evidence: `README.md`)
- Subscriptions → Configuration: updates nodes
- User → Routing rules: configures routing (evidence: `README.md`)
- User → Rule resources: manages rule sets (evidence: `README.md`)
- User → Mesh services: sets up mesh (evidence: `README.md`)
- sing-box core → Live statistics: provides runtime data (evidence: `src/main/workers/stats-worker.ts`)
- Renderer API → Live statistics: requests statistics
- User → Logs: views logs (evidence: `README.md`)
- User → Diagnostics: exports report (evidence: `README.md`)
- User → Application updates: updates app (evidence: `README.md`)
- Electron main → Core and assets: manages assets (evidence: `src/main/index.ts`)
- sing-box core → Rule resources: loads rule sets (evidence: `README.md`)
