# coding-leaf/xray-panel architecture

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

- Interactive diagram: https://gitdiagram.com/coding-leaf/xray-panel
- Repository: https://github.com/coding-leaf/xray-panel

## Overview

Xray Decoupled Panel is a Go/Vue control plane for administering Xray nodes, users, routing, subscriptions, and operational health. Operators enter through the authenticated web console, configure policy and accounts through APIs, and the backend applies changes to SQLite and the running Xray engine; scheduled collection and subscription export provide operational results. The graph also preserves documented Reality checks, tickets, Telegram alerts, and host monitoring. Source evidence is partial, so unsampled capability links are documented or left out rather than inferred from filenames.

Main entry points: [`web/src/api/index.ts`](https://github.com/coding-leaf/xray-panel/blob/master/web/src/api/index.ts) (API client), [`internal/delivery/http/router.go`](https://github.com/coding-leaf/xray-panel/blob/master/internal/delivery/http/router.go) (HTTP API), [`internal/adapter/xray/manager.go`](https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/xray/manager.go) (Xray manager), [`web/src/views/UsersView.vue`](https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/UsersView.vue) (User workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Operator console"]
  node_console["Web console<br/>[App.vue]"]
  node_routing["Routing editor<br/>[RoutingView.vue]"]
  node_user_ui["User workflows<br/>[UsersView.vue]"]
  node_inbound_ui["Inbound workflows<br/>[InboundsView.vue]"]
  node_api["API client<br/>[index.ts]"]
  node_dashboard["Dashboard views<br/>[DashboardView.vue]"]
  node_geodata["Geodata management<br/>[RoutingView.vue]"]
  node_subscription_ui["Subscription assembly<br/>[subscription.ts]"]
end

subgraph group_access["HTTP and services"]
  node_http["HTTP API<br/>[router.go]"]
  node_auth["Authentication<br/>[auth_service.go]"]
  node_user_service["User management<br/>[user_service.go]"]
  node_sub_service["Subscription service<br/>[sub_service.go]"]
  node_protocol["Protocol conversion<br/>[node_converter.go]"]
  node_exporter["Subscription export<br/>[exporter.go]"]
  node_config_service["Configuration service<br/>[config_service.go]"]
  node_tickets["Credential tickets<br/>[ticket_service.go]"]
end

subgraph group_engine["Xray control"]
  node_xray_manager["Xray manager<br/>[manager.go]"]
  node_grpc["Xray gRPC client<br/>[grpc_client.go]"]
  node_config_parser["Config parser<br/>[config_parser.go]"]
end

subgraph group_state["State and operations"]
  node_sqlite[("SQLite repositories<br/>[sqlite_db.go]")]
  node_traffic_cron["Traffic collection<br/>[traffic_sync.go]"]
  node_monitor["Host monitoring"]
  node_reality["Reality inspection"]
  node_telegram["Telegram operations<br/>[bot.go]"]
end

node_operator(("Operator"))

node_operator -->|"operates"| node_console
node_console -->|"requests data"| node_api
node_routing -->|"saves policy"| node_api
node_user_ui -->|"manages users"| node_api
node_inbound_ui -->|"loads nodes"| node_api
node_api -->|"HTTP requests"| node_http
node_http -.->|"authenticates"| node_auth
node_http -.->|"dispatches users"| node_user_service
node_http -.->|"dispatches config"| node_config_service
node_user_ui -.->|"assembles shares"| node_subscription_ui
node_sub_service -.->|"converts nodes"| node_protocol
node_sub_service -.->|"exports formats"| node_exporter
node_config_service -.->|"applies config"| node_xray_manager
node_xray_manager -->|"controls engine"| node_grpc
node_config_parser -.->|"parses config"| node_xray_manager
node_user_service -.->|"persists users"| node_sqlite
node_traffic_cron -->|"polls statistics"| node_grpc
node_traffic_cron -->|"stores traffic"| node_sqlite
node_dashboard -.->|"requests metrics"| node_api
node_reality -->|"sends alerts"| node_telegram
node_geodata -->|"updates data"| node_api
node_tickets -.->|"serves claims"| node_http

click node_console "https://github.com/coding-leaf/xray-panel/blob/master/web/src/App.vue"
click node_routing "https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/RoutingView.vue"
click node_user_ui "https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/UsersView.vue"
click node_inbound_ui "https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/InboundsView.vue"
click node_api "https://github.com/coding-leaf/xray-panel/blob/master/web/src/api/index.ts"
click node_http "https://github.com/coding-leaf/xray-panel/blob/master/internal/delivery/http/router.go"
click node_auth "https://github.com/coding-leaf/xray-panel/blob/master/internal/service/auth_service.go"
click node_user_service "https://github.com/coding-leaf/xray-panel/blob/master/internal/service/user_service.go"
click node_sub_service "https://github.com/coding-leaf/xray-panel/blob/master/internal/service/sub_service.go"
click node_protocol "https://github.com/coding-leaf/xray-panel/blob/master/internal/protocol/node_converter.go"
click node_exporter "https://github.com/coding-leaf/xray-panel/blob/master/internal/sub/exporter.go"
click node_config_service "https://github.com/coding-leaf/xray-panel/blob/master/internal/service/config_service.go"
click node_xray_manager "https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/xray/manager.go"
click node_grpc "https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/xray/grpc_client.go"
click node_config_parser "https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/xray/config_parser.go"
click node_sqlite "https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/repository/sqlite_db.go"
click node_traffic_cron "https://github.com/coding-leaf/xray-panel/blob/master/internal/delivery/cron/traffic_sync.go"
click node_monitor "https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/monitor/gopsutil_monitor.go"
click node_reality "https://github.com/coding-leaf/xray-panel/blob/master/internal/service/reality_monitor_service.go"
click node_telegram "https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/telegram/bot.go"
click node_tickets "https://github.com/coding-leaf/xray-panel/blob/master/internal/service/ticket_service.go"
click node_dashboard "https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/DashboardView.vue"
click node_geodata "https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/RoutingView.vue"
click node_subscription_ui "https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/users/services/subscription.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_console,node_routing,node_user_ui,node_inbound_ui,node_api,node_dashboard,node_geodata,node_subscription_ui toneBlue
class node_http,node_auth,node_user_service,node_sub_service,node_protocol,node_exporter,node_config_service,node_tickets toneAmber
class node_xray_manager,node_grpc,node_config_parser toneMint
class node_sqlite,node_traffic_cron,node_monitor,node_reality,node_telegram toneRose
class node_operator toneIndigo
```

## Components

### Operator console

- [Web console](https://github.com/coding-leaf/xray-panel/blob/master/web/src/App.vue): `web/src/App.vue`
- [Routing editor](https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/RoutingView.vue): `web/src/views/RoutingView.vue`
- [User workflows](https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/UsersView.vue): `web/src/views/UsersView.vue`
- [Inbound workflows](https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/InboundsView.vue): `web/src/views/InboundsView.vue`
- [API client](https://github.com/coding-leaf/xray-panel/blob/master/web/src/api/index.ts): `web/src/api/index.ts`
- [Dashboard views](https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/DashboardView.vue): `web/src/views/DashboardView.vue`
- [Geodata management](https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/RoutingView.vue): `web/src/views/RoutingView.vue`
- [Subscription assembly](https://github.com/coding-leaf/xray-panel/blob/master/web/src/views/users/services/subscription.ts): `web/src/views/users/services/subscription.ts`

### HTTP and services

- [HTTP API](https://github.com/coding-leaf/xray-panel/blob/master/internal/delivery/http/router.go): `internal/delivery/http/router.go`
- [Authentication](https://github.com/coding-leaf/xray-panel/blob/master/internal/service/auth_service.go): `internal/service/auth_service.go`
- [User management](https://github.com/coding-leaf/xray-panel/blob/master/internal/service/user_service.go): `internal/service/user_service.go`
- [Subscription service](https://github.com/coding-leaf/xray-panel/blob/master/internal/service/sub_service.go): `internal/service/sub_service.go`
- [Protocol conversion](https://github.com/coding-leaf/xray-panel/blob/master/internal/protocol/node_converter.go): `internal/protocol/node_converter.go`
- [Subscription export](https://github.com/coding-leaf/xray-panel/blob/master/internal/sub/exporter.go): `internal/sub/exporter.go`
- [Configuration service](https://github.com/coding-leaf/xray-panel/blob/master/internal/service/config_service.go): `internal/service/config_service.go`
- [Credential tickets](https://github.com/coding-leaf/xray-panel/blob/master/internal/service/ticket_service.go): `internal/service/ticket_service.go`

### Xray control

- [Xray manager](https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/xray/manager.go): `internal/adapter/xray/manager.go`
- [Xray gRPC client](https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/xray/grpc_client.go): `internal/adapter/xray/grpc_client.go`
- [Config parser](https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/xray/config_parser.go): `internal/adapter/xray/config_parser.go`

### State and operations

- [SQLite repositories](https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/repository/sqlite_db.go): `internal/adapter/repository/sqlite_db.go`
- [Traffic collection](https://github.com/coding-leaf/xray-panel/blob/master/internal/delivery/cron/traffic_sync.go): `internal/delivery/cron/traffic_sync.go`
- [Host monitoring](https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/monitor/gopsutil_monitor.go): `internal/adapter/monitor/gopsutil_monitor.go`
- [Reality inspection](https://github.com/coding-leaf/xray-panel/blob/master/internal/service/reality_monitor_service.go): `internal/service/reality_monitor_service.go`
- [Telegram operations](https://github.com/coding-leaf/xray-panel/blob/master/internal/adapter/telegram/bot.go): `internal/adapter/telegram/bot.go`

### Other components

- **Operator**

## Connections

- Operator → Web console: operates
- Web console → API client: requests data (evidence: `web/src/App.vue`)
- Routing editor → API client: saves policy (evidence: `web/src/views/RoutingView.vue`)
- User workflows → API client: manages users
- Inbound workflows → API client: loads nodes
- API client → HTTP API: HTTP requests (evidence: `web/src/api/index.ts`)
- HTTP API → Authentication: authenticates
- HTTP API → User management: dispatches users
- HTTP API → Configuration service: dispatches config
- User workflows → Subscription assembly: assembles shares
- Subscription service → Protocol conversion: converts nodes
- Subscription service → Subscription export: exports formats
- Configuration service → Xray manager: applies config
- Xray manager → Xray gRPC client: controls engine
- Config parser → Xray manager: parses config
- User management → SQLite repositories: persists users
- Traffic collection → Xray gRPC client: polls statistics
- Traffic collection → SQLite repositories: stores traffic
- Dashboard views → API client: requests metrics
- Reality inspection → Telegram operations: sends alerts
- Geodata management → API client: updates data (evidence: `web/src/views/RoutingView.vue`)
- Credential tickets → HTTP API: serves claims
