How mhsanaei/3x-ui works
3X-UI is a web control panel for configuring and monitoring Xray servers, clients, and proxy/VPN services across one or more nodes. Operators use the panel to manage protocol configuration and server state; subscribers can also request generated configuration links and subscription formats. The graph covers the UI, API/service layer, persistence, proxy runtimes, and subscription delivery. Connections are limited to README statements and SOURCE INDEX references or shown calls; several documented feature areas are represented by their existing directories because their implementation was not sampled.
Main entry points: server.go Panel operations · IndexPage.tsx Management UI · controller.go Subscription endpoints · main.go Application startup
Components 21
Operator interface
- Management UI
frontend/src/pages/index/IndexPage.tsx - Client management
frontend/src/pages/clients/ClientsPage.tsx - Inbound configuration
frontend/src/pages/inbounds/InboundsPage.tsx - Routing and outbounds
frontend/src/pages/xray/routing/useRoutingColumns.tsx - Node management
frontend/src/pages/nodes/NodesPage.tsx - Panel settings
frontend/src/pages/settings/SettingsPage.tsx
Panel services
- HTTP API
internal/web/controller/server.go - Panel operations
internal/web/service/server.go - Application startup
main.go
Proxy runtime
- Xray management
internal/web/service/server.go - AmneziaWG runtime
internal/amneziawgnet/manager.go - TUIC server
internal/tuic/server.go - MTProto manager
internal/mtproto/manager.go
Subscription delivery
- Subscription endpoints
internal/sub/controller.go - Subscription generation
internal/sub/service.go - Clash output
internal/sub/clash_service.go
Persistence and events
- SQLite or PostgreSQL
internal/database/db.go - Event bus
internal/eventbus/bus.go
Other components
- Panel operator
- Subscription client
- Xray-core
Connections 19
- Panel operator → Management UI: manages
README.md - Management UI → Client management: opens
- Management UI → Inbound configuration: opens
- Management UI → Routing and outbounds: opens
- Management UI → Node management: opens
- Management UI → Panel settings: opens
- Application startup → Panel operations: starts
main.go - Application startup → Subscription endpoints: starts
main.go - HTTP API → Panel operations: delegates
internal/web/controller/server.go - Panel operations → SQLite or PostgreSQL: reads and writes
internal/web/service/server.go - Panel operations → Xray management: manages
internal/web/service/server.go - Panel operations → AmneziaWG runtime: configures
internal/web/service/server.go - Panel operations → TUIC server: configures
- Panel operations → MTProto manager: configures
- Subscription endpoints → Subscription generation: requests data
internal/sub/controller.go - Subscription endpoints → Clash output: serves Clash
internal/sub/controller.go - Subscription generation → SQLite or PostgreSQL: reads
internal/sub/service.go - Subscription client → Subscription endpoints: requests
README.md - Xray management → Xray-core: runs