# hiddify/hiddify-app architecture

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

- Interactive diagram: https://gitdiagram.com/hiddify/hiddify-app
- Repository: https://github.com/hiddify/hiddify-app

## Overview

Hiddify is a cross-platform proxy/VPN client built around Sing-box. The intended user flow is to add or update a remote profile, select a node, and start a tunnel; the README documents those capabilities, but this file tree does not include the shared Flutter UI or profile-management implementation. The graph therefore focuses on visible native entry points, service and tunnel layers, and iOS status handling. Several platform-specific connections are omitted where the sampled source does not establish them.

Main entry points: [`android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt`](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt) (Core service), [`android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt`](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt) (Android entry), [`ios/Runner/VPN/VPNManager.swift`](https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/VPN/VPNManager.swift) (VPN manager), [`ios/HiddifyPacketTunnel/PacketTunnelProvider.swift`](https://github.com/hiddify/hiddify-app/blob/main/ios/HiddifyPacketTunnel/PacketTunnelProvider.swift) (Packet tunnel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android_app["Android app"]
  node_android_entry["Android entry<br/>[MainActivity.kt]"]
  node_android_bridge["Platform handlers"]
  node_android_settings[("Settings<br/>[Settings.kt]")]
end

subgraph group_android_runtime["Android runtime"]
  node_android_service["Core service<br/>[BoxService.kt]"]
  node_android_vpn["VPN service<br/>[VPNService.kt]"]
  node_android_platform["Platform interface"]
  node_android_network["Network monitor"]
  node_android_connection["Service connection"]
end

subgraph group_ios_app["iOS app"]
  node_ios_entry["iOS app entry<br/>[AppDelegate.swift]"]
  node_ios_methods["Method handler"]
  node_ios_vpn_manager["VPN manager<br/>[VPNManager.swift]"]
  node_ios_vpn_config[("VPN configuration<br/>[VPNConfig.swift]")]
  node_ios_status["Status events"]
  node_ios_stats["Stats events"]
  node_ios_command["Command client"]
end

subgraph group_ios_tunnel["iOS tunnel"]
  node_ios_packet["Packet tunnel"]
  node_ios_extension["Tunnel interface"]
  node_ios_paths["Shared file paths<br/>[FilePath.swift]"]
end

subgraph group_profile_api["Profile and core API"]
  node_profile_schema["Profile schema<br/>[profile.proto]"]
  node_profile_service["Profile service API"]
end

node_user(("App user"))
node_singbox{{"Sing-box core"}}

node_user -.->|"uses"| node_android_entry
node_android_entry -->|"registers handlers"| node_android_bridge
node_android_entry -->|"connects service"| node_android_connection
node_android_entry -->|"starts service"| node_android_service
node_android_service -->|"reads settings"| node_android_settings
node_android_service -->|"uses VPN service"| node_android_vpn
node_android_service -->|"sets up interface"| node_android_platform
node_android_service -->|"starts monitor"| node_android_network
node_android_vpn -->|"configures tunnel"| node_android_platform
node_ios_entry -.->|"provides app entry"| node_ios_methods
node_ios_methods -->|"starts and stops"| node_ios_vpn_manager
node_ios_vpn_manager -->|"loads configuration"| node_ios_vpn_config
node_ios_status -->|"reads status"| node_ios_vpn_manager
node_ios_stats -->|"uses client"| node_ios_command
node_ios_packet -.->|"uses interface"| node_ios_extension
node_ios_vpn_manager -->|"uses shared paths"| node_ios_paths
node_android_service -.->|"runs proxy core"| node_singbox
node_ios_packet -.->|"runs proxy core"| node_singbox
node_user -.->|"uses"| node_ios_entry

click node_android_entry "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt"
click node_android_bridge "https://github.com/hiddify/hiddify-app/tree/main/android/app/src/main/kotlin/com/hiddify/hiddify"
click node_android_settings "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/Settings.kt"
click node_android_service "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt"
click node_android_vpn "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt"
click node_android_platform "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/PlatformInterfaceWrapper.kt"
click node_android_network "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/DefaultNetworkMonitor.kt"
click node_android_connection "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/ServiceConnection.kt"
click node_ios_entry "https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/AppDelegate.swift"
click node_ios_methods "https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/Handlers/MethodHandler.swift"
click node_ios_vpn_manager "https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/VPN/VPNManager.swift"
click node_ios_vpn_config "https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/VPN/VPNConfig.swift"
click node_ios_status "https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/Handlers/StatusEventHandler.swift"
click node_ios_stats "https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/Handlers/StatsEventHandler.swift"
click node_ios_command "https://github.com/hiddify/hiddify-app/blob/main/ios/Shared/CommandClient.swift"
click node_ios_packet "https://github.com/hiddify/hiddify-app/blob/main/ios/HiddifyPacketTunnel/PacketTunnelProvider.swift"
click node_ios_extension "https://github.com/hiddify/hiddify-app/blob/main/ios/HiddifyPacketTunnel/SingBox/ExtensionPlatformInterface.swift"
click node_ios_paths "https://github.com/hiddify/hiddify-app/blob/main/ios/Shared/FilePath.swift"
click node_profile_schema "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/protos/v2/profile/profile.proto"
click node_profile_service "https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/protos/v2/profile/profile_service.proto"

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_android_entry,node_android_bridge,node_android_settings,node_user toneBlue
class node_android_service,node_android_vpn,node_android_platform,node_android_network,node_android_connection toneAmber
class node_ios_entry,node_ios_methods,node_ios_vpn_manager,node_ios_vpn_config,node_ios_status,node_ios_stats,node_ios_command toneMint
class node_ios_packet,node_ios_extension,node_ios_paths toneRose
class node_profile_schema,node_profile_service,node_singbox toneIndigo
```

## Components

### Android app

- [Android entry](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt): `android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt`
- [Platform handlers](https://github.com/hiddify/hiddify-app/tree/main/android/app/src/main/kotlin/com/hiddify/hiddify): `android/app/src/main/kotlin/com/hiddify/hiddify`
- [Settings](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/Settings.kt): `android/app/src/main/kotlin/com/hiddify/hiddify/Settings.kt`

### Android runtime

- [Core service](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt): `android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt`
- [VPN service](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt): `android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt`
- [Platform interface](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/PlatformInterfaceWrapper.kt): `android/app/src/main/kotlin/com/hiddify/hiddify/bg/PlatformInterfaceWrapper.kt`
- [Network monitor](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/DefaultNetworkMonitor.kt): `android/app/src/main/kotlin/com/hiddify/hiddify/bg/DefaultNetworkMonitor.kt`
- [Service connection](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/kotlin/com/hiddify/hiddify/bg/ServiceConnection.kt): `android/app/src/main/kotlin/com/hiddify/hiddify/bg/ServiceConnection.kt`

### iOS app

- [iOS app entry](https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/AppDelegate.swift): `ios/Runner/AppDelegate.swift`
- [Method handler](https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/Handlers/MethodHandler.swift): `ios/Runner/Handlers/MethodHandler.swift`
- [VPN manager](https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/VPN/VPNManager.swift): `ios/Runner/VPN/VPNManager.swift`
- [VPN configuration](https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/VPN/VPNConfig.swift): `ios/Runner/VPN/VPNConfig.swift`
- [Status events](https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/Handlers/StatusEventHandler.swift): `ios/Runner/Handlers/StatusEventHandler.swift`
- [Stats events](https://github.com/hiddify/hiddify-app/blob/main/ios/Runner/Handlers/StatsEventHandler.swift): `ios/Runner/Handlers/StatsEventHandler.swift`
- [Command client](https://github.com/hiddify/hiddify-app/blob/main/ios/Shared/CommandClient.swift): `ios/Shared/CommandClient.swift`

### iOS tunnel

- [Packet tunnel](https://github.com/hiddify/hiddify-app/blob/main/ios/HiddifyPacketTunnel/PacketTunnelProvider.swift): `ios/HiddifyPacketTunnel/PacketTunnelProvider.swift`
- [Tunnel interface](https://github.com/hiddify/hiddify-app/blob/main/ios/HiddifyPacketTunnel/SingBox/ExtensionPlatformInterface.swift): `ios/HiddifyPacketTunnel/SingBox/ExtensionPlatformInterface.swift`
- [Shared file paths](https://github.com/hiddify/hiddify-app/blob/main/ios/Shared/FilePath.swift): `ios/Shared/FilePath.swift`

### Profile and core API

- [Profile schema](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/protos/v2/profile/profile.proto): `android/app/src/main/protos/v2/profile/profile.proto`
- [Profile service API](https://github.com/hiddify/hiddify-app/blob/main/android/app/src/main/protos/v2/profile/profile_service.proto): `android/app/src/main/protos/v2/profile/profile_service.proto`

### Other components

- **App user**
- **Sing-box core**

## Connections

- App user → Android entry: uses (evidence: `README.md`)
- Android entry → Platform handlers: registers handlers (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt`)
- Android entry → Service connection: connects service (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt`)
- Android entry → Core service: starts service (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/MainActivity.kt`)
- Core service → Settings: reads settings (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt`)
- Core service → VPN service: uses VPN service (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt`)
- Core service → Platform interface: sets up interface (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt`)
- Core service → Network monitor: starts monitor (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt`)
- VPN service → Platform interface: configures tunnel (evidence: `android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt`)
- iOS app entry → Method handler: provides app entry
- Method handler → VPN manager: starts and stops (evidence: `ios/Runner/Handlers/MethodHandler.swift`)
- VPN manager → VPN configuration: loads configuration (evidence: `ios/Runner/VPN/VPNManager.swift`)
- Status events → VPN manager: reads status (evidence: `ios/Runner/Handlers/StatusEventHandler.swift`)
- Stats events → Command client: uses client (evidence: `ios/Runner/Handlers/StatsEventHandler.swift`)
- Packet tunnel → Tunnel interface: uses interface
- VPN manager → Shared file paths: uses shared paths (evidence: `ios/Runner/VPN/VPNManager.swift`)
- Core service → Sing-box core: runs proxy core (evidence: `README.md`)
- Packet tunnel → Sing-box core: runs proxy core (evidence: `README.md`)
- App user → iOS app entry: uses (evidence: `README.md`)
