Xray panel supporting multi-protocol multi-user expire day & traffic & ip limit (Vmess & Vless & Trojan & ShadowSocks & Wireguard)
Find a file
google-labs-jules[bot] ab4229c73c feat: Finalize Docker setup and update README for new frontend
This commit marks the completion of the primary development phase for the new React/Next.js frontend and the setup for a Docker-based deployment.

Key accomplishments in this phase:
- **Inbounds Management (Concluded)**
  - Full CRUD for inbounds and their clients (VMess, VLESS, Trojan via UI; Shadowsocks via UI for main params, others via JSON).
  - QR Code and Subscription Link display.
- **Settings Management (Concluded)**
  - Comprehensive settings page with tabs for Panel, User Account (Credentials & 2FA), Telegram Bot, Subscription Links, and Other settings.
- **Other Features**
  - Xray Logs Modal.
  - Xray Version and Geo Files Management Modal.
- **Deployment Strategy & Integration (Core Setup Done)**
  - Successfully resolved the build issues by confirming your environment can build the full-featured Next.js application.
  - Created `Dockerfile` for the `new-frontend` (Next.js app).
  - Created `Dockerfile.backend` for the Go backend.
  - Updated `docker-compose.yml` to manage both frontend and backend services, including network communication and environment variable setup (like NEXT_PUBLIC_API_BASE_URL).
  - Drafted and finalized a new `install.sh` script that automates the installation of Docker, Docker Compose, clones the repository, and uses `docker-compose` to build and run the application.
  - Significantly updated `README.md` with detailed instructions for the new Docker-based installation and management.

**Response to your feedback ("It's vague, tell me how to apply this"):**
The primary way to "apply" these changes and run the new panel is by using the updated `install.sh` script on a clean server or by following the Docker Compose instructions in the new `README.md`.

The general steps outlined in the new README are:
1.  Ensure prerequisites (Docker, Docker Compose, git, curl) are met. The `install.sh` attempts to install Docker and Docker Compose.
2.  Use the quick install command: `bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)` (assuming `install.sh` in `main` branch is updated with the new content).
3.  The script will guide you through setting host ports and then run `docker compose up -d --build`.
4.  The frontend will be accessible on the specified frontend port (default 3000), and it will communicate with the backend service running in another Docker container.

**Next Steps (Primarily for you/maintainer):**
1.  **Thorough Testing of `install.sh`:** The new installation script needs to be tested on various target Linux distributions.
2.  **Full Functional Testing:** All aspects of the new UI should be tested in a deployed environment.
3.  **Final UI/UX Refinements & Dark Mode Polish:** Based on testing.
4.  Consideration of remaining minor features (e.g., DB backup/restore UI, Xray JSON config UI) if still desired.

The frontend codebase is in `new-frontend/`. All Docker-related files (`Dockerfile.backend`, `docker-compose.yml`, updated `install.sh`, updated `README.md`) are in the repository root.
2025-06-04 18:51:45 +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 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
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 chore: X_UI_ENABLE_FAIL2BAN -> XUI_ENABLE_FAIL2BAN (#3030) 2025-05-22 08:21:23 +02:00
Dockerfile 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
Dockerfile.backend 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
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 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
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 feat: Finalize Docker setup and update README for new frontend 2025-06-04 18:51:45 +00:00
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

  • USDT (TRC20): TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC
  • MATIC (polygon): 0x41C9548675D044c6Bfb425786C765bc37427256A
  • LTC (Litecoin): ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv

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/MHSanaei/3x-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