How allphaaa77/3x-ui works
3X-UI is a web control panel for configuring and operating Xray proxy servers, from one VPS or across multiple nodes. The main workflow runs from panel users through the frontend and REST API to management services, which persist configuration and apply it to Xray runtimes; clients then receive share links or subscriptions. The graph also preserves monitoring, Telegram, and MTProto capabilities. Relationships among sampled modules use source-index references or excerpts; broader product links are documented in the README, and unsampled implementation details are not inferred.
Main entry points: controller.go Subscription routes · http-init.ts API client · db.go Database · check_client_ip_job.go Traffic and IP limits
Components 22
Web panel
- Management UI
frontend/src/pages/index/IndexPage.tsx - API client
frontend/src/api/http-init.ts - Web server
internal/web/controller/server.go - API controllers
internal/web/controller/client.go
Management services
- Client management
internal/web/service/client_bulk.go - Panel services
internal/web/service/server.go - Database
internal/database/db.go - Traffic and IP limits
internal/web/job/check_client_ip_job.go - Proxy configuration
frontend/src/pages/xray/routing/useRoutingColumns.tsx - Inbound configuration
frontend/src/pages/inbounds/form/InboundFormModal.tsx - Multi-node management
frontend/src/pages/nodes/NodesPage.tsx - Telegram management
internal/web/service/tgbot/tgbot_router.go
Proxy runtime
- Node runtime dispatch
internal/web/runtime/manager.go - Xray integration
internal/xray/api.go - MTProto manager
internal/mtproto/manager.go
Client delivery
- Subscription routes
internal/sub/controller.go - Subscription generation
internal/sub/service.go - JSON subscriptions
internal/sub/json_service.go - Clash subscriptions
internal/sub/clash_service.go
Other components
- Panel user
- Fail2ban
- Proxy clients
Connections 23
- Panel user → Management UI: manages servers
README.md - Management UI → API client: requests data
- API client → Web server: calls REST API
- Web server → API controllers: routes requests
internal/web/controller/server.go - API controllers → Panel services: delegates operations
- Panel services → Database: reads and writes
internal/web/service/server.go - Panel services → Xray integration: controls Xray
internal/web/service/server.go - Client management → Database: updates client records
internal/web/service/client_bulk.go - Client management → Xray integration: applies client changes
internal/web/service/client_bulk.go - Inbound configuration → API client: configures inbounds
- Proxy configuration → API client: configures routing
- Multi-node management → Node runtime dispatch: selects node runtime
- Node runtime dispatch → Database: loads node records
internal/web/runtime/manager.go - Traffic and IP limits → Database: checks client limits
internal/web/job/check_client_ip_job.go - Traffic and IP limits → Xray integration: checks IP usage
internal/web/job/check_client_ip_job.go - Web server → Subscription routes: serves subscription routes
README.md - Subscription routes → Subscription generation: builds subscription data
internal/sub/controller.go - Subscription routes → JSON subscriptions: serves JSON format
internal/sub/controller.go - Subscription routes → Clash subscriptions: serves Clash format
internal/sub/controller.go - Subscription generation → Proxy clients: generates share links
README.md - Telegram management → Panel user: supports remote management
README.md - Traffic and IP limits → Fail2ban: enforces IP limits
README.md - MTProto manager → Proxy configuration: supports MTProto inbounds