Xray panel supporting multi-protocol multi-user expire day & traffic & ip limit (Vmess & Vless & Trojan & ShadowSocks & Wireguard)
Find a file
google-labs-jules[bot] c971912ae3 Fix: Resolve backend Docker build and runtime errors
This commit addresses two primary issues in the backend Docker setup:

1.  **Database Initialization Error (CGO_ENABLED):**
    The Go binary was previously compiled with `CGO_ENABLED=0`. This caused an error ("Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work") because `go-sqlite3` requires CGo.
    - Modified `Dockerfile.backend` to set `CGO_ENABLED=1` during the build.
    - Added `gcc`, `musl-dev`, and `sqlite-dev` to the builder stage dependencies for CGo compilation on Alpine.
    - Added `sqlite` to the final image stage for runtime library availability.

2.  **fail2ban-client Not Found Error:**
    The `DockerEntrypoint.sh` script attempted to start `fail2ban-client` without ensuring its presence in the image.
    - Added `fail2ban` to the `apk add` command in the final stage of `Dockerfile.backend`.
    - Updated `DockerEntrypoint.sh` to check if `fail2ban-client` is available before attempting to start it, preventing errors if it's not found (e.g., if `XUI_ENABLE_FAIL2BAN` is true but installation failed).

These changes should allow the backend container to build and start correctly, resolving the reported database and fail2ban errors. You will need to run `docker compose up -d --build` to apply these changes.
2025-06-05 07:33:02 +00:00
.github Xray-core v25.5.16 2025-05-16 13:05:46 +02:00
config v2.6.0 2025-05-16 14:26:20 +02:00
database chore: implement 2fa auth (#2968) 2025-05-08 16:20:58 +02:00
logger Refactor: Use any instead of interface{} 2025-03-12 20:43:43 +01:00
media media - telebot 2024-12-21 14:00:21 +01:00
new-frontend Update Dockerfile 2025-06-05 01:16:47 +03:30
sub fix: encoding subscription title in base64 2025-04-15 19:29:54 +07:00
util feat: hashing user passwords 2025-05-03 16:27:53 +07:00
web feat: add command list in telegram bot (#3027) 2025-05-28 15:26:29 +07:00
xray xray log - minor change 2025-03-13 11:48:00 +01:00
.gitignore feat: support .env file (#3013) 2025-05-17 12:33:22 +02:00
docker-compose.yml Jules was unable to complete the task in time. Please review the work done so far and provide feedback for Jules to continue. 2025-06-04 18:36:16 +00:00
DockerEntrypoint.sh Fix: Resolve backend Docker build and runtime errors 2025-06-05 07:33:02 +00:00
Dockerfile Update Dockerfile 2025-06-05 01:37:52 +03:30
Dockerfile.backend Fix: Resolve backend Docker build and runtime errors 2025-06-05 07:33:02 +00:00
DockerInit.sh Xray-core v25.5.16 2025-05-16 13:05:46 +02:00
go.mod feat: support .env file (#3013) 2025-05-17 12:33:22 +02:00
go.sum feat: support .env file (#3013) 2025-05-17 12:33:22 +02:00
install.sh Update install.sh 2025-06-04 23:25:43 +03:30
LICENSE 3x-ui 2023-02-09 22:48:06 +03:30
main.go feat: support .env file (#3013) 2025-05-17 12:33:22 +02:00
new_install_sh_components.txt Jules was unable to complete the task in time. Please review the work done so far and provide feedback for Jules to continue. 2025-06-04 18:36:16 +00:00
README.ar_EG.md v2.6.0 2025-05-16 14:26:20 +02:00
README.es_ES.md v2.6.0 2025-05-16 14:26:20 +02:00
README.fa_IR.md v2.6.0 2025-05-16 14:26:20 +02:00
README.md Update README.md 2025-06-04 23:11:34 +03:30
README.ru_RU.md v2.6.0 2025-05-16 14:26:20 +02:00
README.zh_CN.md v2.6.0 2025-05-16 14:26:20 +02:00
x-ui.service 3x-ui 2023-02-09 22:48:06 +03:30
x-ui.sh Code refactoring (#3011) 2025-05-16 20:23:57 +02:00

English | فارسی | العربية | 中文 | Español | Русский

3x-ui

An Advanced Web Panel • Built on Xray Core • With a Modern React/Next.js Frontend

GO Version Downloads License

Disclaimer: This project is only for personal learning and communication, please do not use it for illegal purposes. Using it in a production environment is at your own risk.

If this project is helpful to you, you may wish to give it a🌟

Buy Me A Coffee

New Frontend!

This version of 3X-UI features a completely revamped frontend built with React, Next.js, and Tailwind CSS, offering a modern, responsive, and user-friendly experience. Key improvements include:

  • Enhanced User Interface (UI) and User Experience (UX).
  • Improved responsiveness for mobile and tablet devices.
  • Integrated Dark Mode.
  • Streamlined management of inbounds, clients, and settings.

This new version is designed to be run using Docker and Docker Compose for ease of installation, updates, and management.

Prerequisites:

  • A Linux server (Ubuntu 22.04+, Debian 12+, CentOS 8+, Fedora 36+, or other compatible distributions).
  • Root or sudo privileges.
  • curl and git installed (the installation script will attempt to install them if missing).
  • Docker and Docker Compose plugin (the installation script will attempt to install them if missing).

Quick Install Command:

bash <(curl -Ls https://raw.githubusercontent.com/santiyagoburcart/N-ui/main/install.sh)

(Note: The URL should point to the new install.sh in the main branch or a specific release tag once updated).

Installation Steps Explained by the Script:

  1. Checks for root privileges and essential tools (curl, git).
  2. Installs/Updates Docker and Docker Compose plugin if they are not present.
  3. Prompts you for an installation directory (default: /opt/3x-ui-docker).
  4. Clones (or updates an existing clone of) the 3x-ui repository into a source subdirectory (e.g., 3x-ui-source).
  5. Navigates into the source directory.
  6. Creates necessary data directories (db, cert) for persistent storage.
  7. Prompts you for HOST ports for the new frontend (default: 3000) and the backend panel (default: 2053).
  8. Generates a .env file with these port configurations and sets up NEXT_PUBLIC_API_BASE_URL for communication between the frontend and backend containers.
  9. Runs docker compose up -d --build --remove-orphans to build the Docker images (for both backend and the new frontend) and start the services in detached mode.

After installation, the new frontend panel should be accessible at http://<your_server_ip>:[FRONTEND_PORT] (e.g., http://<your_server_ip>:3000).

🐳 Managing Services with Docker Compose

Once installed, you can manage the panel services using standard docker compose commands from within the source directory (e.g., /opt/3x-ui-docker/3x-ui-source):

  • Start services: docker compose up -d
  • Stop services: docker compose stop
  • Restart services: docker compose restart
  • View logs for backend: docker compose logs -f backend
  • View logs for frontend: docker compose logs -f frontend
  • Update (rebuild and restart):
    git pull # Get latest source
    docker compose up -d --build --remove-orphans # Rebuild images and restart
    
  • Uninstall:
    docker compose down -v # Stops and removes containers, networks, and volumes
    # Then remove the installation directory if desired
    # cd .. && rm -rf /opt/3x-ui-docker
    

⚙️ Panel Configuration after Install

  • Initial Login: Default credentials for the panel (if not changed during install script or via backend ENV) are usually admin/admin. Please change these immediately via the panel's "Settings" > "User Account" tab.
  • API URL: The NEXT_PUBLIC_API_BASE_URL for the frontend is configured in the .env file created by the install.sh script. It points to the backend service within the Docker network (e.g., http://backend:2053).
  • Ports: Host ports for frontend and backend are also defined in the .env file and used by docker-compose.yml.
  • All other panel settings can be configured through the web interface in the "Settings" section.

SSL Certificate

Click for SSL Certificate details (General Guidance)

To secure your panel with an SSL certificate when using Docker:

  1. Obtain SSL Certificates: Use tools like Certbot (running on your host machine or in a separate Docker container) to obtain SSL certificates for your domain. Make sure your domain correctly resolves to your server's IP address.
  2. Mount Certificates into Backend Container:
    • Place your certificate (fullchain.pem or cert.pem) and private key (privkey.pem or key.pem) files in a directory on your host machine (e.g., the cert directory created by install.sh at $INSTALL_DIR/3x-ui-source/cert/).
    • The docker-compose.yml already mounts ./cert/:/root/cert/ into the backend container.
  3. Configure Panel Settings:
    • In the 3X-UI panel settings (under "Panel Settings" tab), set:
      • Panel Domain: Your domain (e.g., panel.yourdomain.com).
      • SSL Certificate File Path: /root/cert/your_cert.pem (adjust filename accordingly).
      • SSL Key File Path: /root/cert/your_key.pem (adjust filename accordingly).
    • Save settings and restart the panel (the "Restart Panel" button in settings, or docker compose restart backend).
  4. Access via HTTPS: You should now be able to access your panel via https://yourdomain.com:[FRONTEND_PORT]. You might also need a reverse proxy (like Nginx or Traefik) in front of the frontend Docker container to handle SSL termination directly for the frontend port if desired, or configure the Next.js server itself for HTTPS if running standalone with more complex setup (not covered by default Dockerfile).

Note: The old ACME script (x-ui ... SSL Certificate Management) run directly from the binary might not work as expected within the Docker setup without further adaptation. Managing SSL certificates on the host or via a dedicated SSL reverse proxy container is generally recommended with Dockerized applications.

Click for legacy installation details (references old version)

The following installation methods refer to the previous version of 3X-UI with the older frontend. For the new React/Next.js frontend, please use the Docker-based installation described above.

# Legacy main install command
bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/refs/tags/v2.6.0/install.sh)

To install a specific legacy version, use following installation command. e.g., ver v1.7.9:

VERSION=v1.7.9 && bash <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/$VERSION/install.sh") $VERSION

Manual installation of legacy versions also involved downloading pre-compiled binaries and setting up systemd services manually. This is no longer the recommended approach.

  • Ubuntu 22.04+
  • Debian 12+
  • CentOS 8+ / RHEL 8+ (or derivatives like AlmaLinux, Rocky Linux)
  • Fedora 36+
  • Other Linux distributions that support recent versions of Docker and Docker Compose.

Features (New Frontend Highlights)

  • System Status Monitoring (Real-time Dashboard)
  • Comprehensive Inbound Management with dedicated UIs for VMESS, VLESS, Trojan, Shadowsocks clients.
  • Streamlined Client Management within Inbounds (Add, Edit, Delete, Reset Traffic, QR Codes, Share Links).
  • Full-Featured Settings Management via a tabbed interface (Panel, User Account & 2FA, Telegram Bot, Subscription Links, Other).
  • Xray Log Viewer with filtering and download.
  • Xray Version Management and GeoIP/GeoSite file updater.
  • Dark/Light Theme.
  • Responsive design for desktop, tablet, and mobile.
  • Search within all inbounds and clients (To be verified/enhanced in new UI).
  • Customizable Xray configuration templates (Via direct JSON editing in settings for now).
  • Supports HTTPS access (Configuration via panel settings, assuming certs are mounted).
  • Traffic statistics, traffic limit, expiration time limit for inbounds and clients.
  • Export/Import database from the panel (API exists, UI to be added in "Other Features").

Preview (New Frontend)

(Screenshots for the new React/Next.js frontend will be added here soon. The existing screenshots below are for the older version.)

3x-ui

A Special Thanks to

  • alireza0
  • All contributors and users of 3x-ui.

Stargazers over Time

Stargazers over time