# chen08209/flclash architecture

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

- Interactive diagram: https://gitdiagram.com/chen08209/flclash
- Repository: https://github.com/chen08209/flclash

## Overview

FlClash is a cross-platform Clash.Meta proxy client. The documented user journey is importing a profile, configuring proxy behavior, and starting the proxy; the README also describes live traffic/DNS/log views, backup and restore, and platform-specific controls. The supplied excerpts expose Android service startup and the Go-core bridge, but not the Flutter UI or profile, backup, and live-view implementations, so those capabilities are represented only at the documented subsystem level. Edges are limited to relationships shown in excerpts or explicitly documented in the README.

Main entry points: [`README.md`](https://github.com/chen08209/flclash/blob/main/README.md) (FlClash client), [`android/service/src/main/java/com/follow/clash/service/VpnService.kt`](https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/VpnService.kt) (VPN service), [`android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`](https://github.com/chen08209/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceController.kt) (Service controller), [`core/lib.go`](https://github.com/chen08209/flclash/blob/main/core/lib.go) (mihomo core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App controls"]
  node_client["FlClash client<br/>[README.md]"]
  node_profiles["Profiles<br/>[profile_base.go]"]
  node_editor["Profile editor"]
  node_override["Overrides and rules<br/>[service_rules.go]"]
  node_liveviews["Live views<br/>[server.go]"]
  node_backup["Backup and restore<br/>[README.md]"]
end

subgraph group_android["Android runtime"]
  node_state["Service state<br/>[ServiceState.kt]"]
  node_controller["Service controller"]
  node_proxyservice["Proxy service<br/>[ProxyService.kt]"]
  node_vpnservice["VPN service<br/>[VpnService.kt]"]
  node_modules["Service modules<br/>[ServiceModules.kt]"]
  node_network["Network observer<br/>[NetworkObserver.kt]"]
  node_vpnoptions["VPN options<br/>[VpnOptions.kt]"]
end

subgraph group_engine["Proxy engine"]
  node_bridge["Core bridge<br/>[Core.kt]"]
  node_core["mihomo core<br/>[lib.go]"]
  node_routing["Rule routing<br/>[service_rules.go]"]
  node_dns["DNS queries<br/>[dns_query.go]"]
  node_coreapi["Core server API<br/>[server.go]"]
end

subgraph group_platform["Platform features"]
  node_quicktile["Quick Settings tile<br/>[TileService.kt]"]
  node_hotkeys["Desktop hotkeys<br/>[hotkey.rs]"]
  node_tray["Desktop tray"]
  node_tun["TUN mode<br/>[tun.go]"]
end

node_user(("User"))

node_user -->|"uses"| node_client
node_client -.->|"imports"| node_profiles
node_profiles -.->|"edits"| node_editor
node_profiles -.->|"configures"| node_override
node_client -.->|"views"| node_liveviews
node_client -.->|"backs up"| node_backup
node_controller -->|"starts service"| node_proxyservice
node_controller -->|"starts service"| node_vpnservice
node_controller -->|"invokes core"| node_bridge
node_controller -->|"starts observer"| node_network
node_proxyservice -->|"starts modules"| node_modules
node_vpnservice -->|"starts modules"| node_modules
node_vpnservice -->|"reads options"| node_vpnoptions
node_vpnservice -->|"starts TUN"| node_bridge
node_bridge -.->|"bridges calls"| node_core
node_quicktile -->|"observes state"| node_state
node_quicktile -.->|"toggles via activity"| node_controller
node_hotkeys -.->|"integrates with"| node_client
node_tray -.->|"integrates with"| node_client
node_core -.->|"applies rules"| node_routing
node_core -.->|"handles DNS"| node_dns
node_core -.->|"serves API"| node_coreapi
node_vpnservice -.->|"provides TUN mode"| node_tun

click node_client "https://github.com/chen08209/flclash/blob/main/README.md"
click node_profiles "https://github.com/chen08209/flclash/blob/main/core/profile_base.go"
click node_editor "https://github.com/chen08209/flclash/tree/main/plugins/rust_api/rust/src/editor"
click node_override "https://github.com/chen08209/flclash/blob/main/core/service_rules.go"
click node_liveviews "https://github.com/chen08209/flclash/blob/main/core/server.go"
click node_backup "https://github.com/chen08209/flclash/blob/main/README.md"
click node_state "https://github.com/chen08209/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceState.kt"
click node_controller "https://github.com/chen08209/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceController.kt"
click node_proxyservice "https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/ProxyService.kt"
click node_vpnservice "https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/VpnService.kt"
click node_modules "https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/modules/ServiceModules.kt"
click node_network "https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/NetworkObserver.kt"
click node_vpnoptions "https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/models/VpnOptions.kt"
click node_bridge "https://github.com/chen08209/flclash/blob/main/android/core/src/main/java/com/follow/clash/core/Core.kt"
click node_core "https://github.com/chen08209/flclash/blob/main/core/lib.go"
click node_routing "https://github.com/chen08209/flclash/blob/main/core/service_rules.go"
click node_dns "https://github.com/chen08209/flclash/blob/main/core/dns_query.go"
click node_coreapi "https://github.com/chen08209/flclash/blob/main/core/server.go"
click node_quicktile "https://github.com/chen08209/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/TileService.kt"
click node_hotkeys "https://github.com/chen08209/flclash/blob/main/plugins/rust_api/rust/src/api/hotkey.rs"
click node_tray "https://github.com/chen08209/flclash/tree/main/plugins/tray"
click node_tun "https://github.com/chen08209/flclash/blob/main/core/tun/tun.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_client,node_profiles,node_editor,node_override,node_liveviews,node_backup,node_user toneBlue
class node_state,node_controller,node_proxyservice,node_vpnservice,node_modules,node_network,node_vpnoptions toneAmber
class node_bridge,node_core,node_routing,node_dns,node_coreapi toneMint
class node_quicktile,node_hotkeys,node_tray,node_tun toneRose
```

## Components

### App controls

- [FlClash client](https://github.com/chen08209/flclash/blob/main/README.md): `README.md`
- [Profiles](https://github.com/chen08209/flclash/blob/main/core/profile_base.go): `core/profile_base.go`
- [Profile editor](https://github.com/chen08209/flclash/tree/main/plugins/rust_api/rust/src/editor): `plugins/rust_api/rust/src/editor`
- [Overrides and rules](https://github.com/chen08209/flclash/blob/main/core/service_rules.go): `core/service_rules.go`
- [Live views](https://github.com/chen08209/flclash/blob/main/core/server.go): `core/server.go`
- [Backup and restore](https://github.com/chen08209/flclash/blob/main/README.md): `README.md`

### Android runtime

- [Service state](https://github.com/chen08209/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceState.kt): `android/app/src/main/kotlin/com/follow/clash/ServiceState.kt`
- [Service controller](https://github.com/chen08209/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/ServiceController.kt): `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`
- [Proxy service](https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/ProxyService.kt): `android/service/src/main/java/com/follow/clash/service/ProxyService.kt`
- [VPN service](https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/VpnService.kt): `android/service/src/main/java/com/follow/clash/service/VpnService.kt`
- [Service modules](https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/modules/ServiceModules.kt): `android/service/src/main/java/com/follow/clash/service/modules/ServiceModules.kt`
- [Network observer](https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/NetworkObserver.kt): `android/service/src/main/java/com/follow/clash/service/NetworkObserver.kt`
- [VPN options](https://github.com/chen08209/flclash/blob/main/android/service/src/main/java/com/follow/clash/service/models/VpnOptions.kt): `android/service/src/main/java/com/follow/clash/service/models/VpnOptions.kt`

### Proxy engine

- [Core bridge](https://github.com/chen08209/flclash/blob/main/android/core/src/main/java/com/follow/clash/core/Core.kt): `android/core/src/main/java/com/follow/clash/core/Core.kt`
- [mihomo core](https://github.com/chen08209/flclash/blob/main/core/lib.go): `core/lib.go`
- [Rule routing](https://github.com/chen08209/flclash/blob/main/core/service_rules.go): `core/service_rules.go`
- [DNS queries](https://github.com/chen08209/flclash/blob/main/core/dns_query.go): `core/dns_query.go`
- [Core server API](https://github.com/chen08209/flclash/blob/main/core/server.go): `core/server.go`

### Platform features

- [Quick Settings tile](https://github.com/chen08209/flclash/blob/main/android/app/src/main/kotlin/com/follow/clash/TileService.kt): `android/app/src/main/kotlin/com/follow/clash/TileService.kt`
- [Desktop hotkeys](https://github.com/chen08209/flclash/blob/main/plugins/rust_api/rust/src/api/hotkey.rs): `plugins/rust_api/rust/src/api/hotkey.rs`
- [Desktop tray](https://github.com/chen08209/flclash/tree/main/plugins/tray): `plugins/tray`
- [TUN mode](https://github.com/chen08209/flclash/blob/main/core/tun/tun.go): `core/tun/tun.go`

### Other components

- **User**

## Connections

- User → FlClash client: uses (evidence: `README.md`)
- FlClash client → Profiles: imports
- Profiles → Profile editor: edits
- Profiles → Overrides and rules: configures
- FlClash client → Live views: views
- FlClash client → Backup and restore: backs up
- Service controller → Proxy service: starts service (evidence: `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`)
- Service controller → VPN service: starts service (evidence: `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`)
- Service controller → Core bridge: invokes core (evidence: `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`)
- Service controller → Network observer: starts observer (evidence: `android/app/src/main/kotlin/com/follow/clash/ServiceController.kt`)
- Proxy service → Service modules: starts modules (evidence: `android/service/src/main/java/com/follow/clash/service/ProxyService.kt`)
- VPN service → Service modules: starts modules (evidence: `android/service/src/main/java/com/follow/clash/service/VpnService.kt`)
- VPN service → VPN options: reads options (evidence: `android/service/src/main/java/com/follow/clash/service/VpnService.kt`)
- VPN service → Core bridge: starts TUN (evidence: `android/service/src/main/java/com/follow/clash/service/VpnService.kt`)
- Core bridge → mihomo core: bridges calls
- Quick Settings tile → Service state: observes state (evidence: `android/app/src/main/kotlin/com/follow/clash/TileService.kt`)
- Quick Settings tile → Service controller: toggles via activity
- Desktop hotkeys → FlClash client: integrates with (evidence: `README.md`)
- Desktop tray → FlClash client: integrates with (evidence: `README.md`)
- mihomo core → Rule routing: applies rules
- mihomo core → DNS queries: handles DNS
- mihomo core → Core server API: serves API
- VPN service → TUN mode: provides TUN mode (evidence: `README.md`)
