# shepard86rus/3x-ui-dual-domain architecture

> Architecture diagram of the GitHub repository shepard86rus/3x-ui-dual-domain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shepard86rus/3x-ui-dual-domain
- Repository: https://github.com/shepard86rus/3x-ui-dual-domain

## Overview

This repository provides a server installer and health checker for a two-domain 3x-ui deployment. The principal workflow is: an administrator prepares DNS and runs install, completes the documented panel setup, runs healthcheck, then distributes subscription details to clients. The README also documents backup/restore, upgrades, optional XHTTP and a Telegram bot. The main installer’s implementation was not sampled, so its documented responsibilities share the installer path; relationships below are based on README statements, not inspected runtime calls.

Main entry points: [`3x-ui-dual-domain.sh`](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh) (Installer), [`tools/hub/tgbot-hub.sh`](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/tgbot-hub.sh) (Hub bot tools), [`tools/hub/patch-hub.py`](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/patch-hub.py) (Hub patcher), [`tools/hub/hub-clients.sh`](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/hub-clients.sh) (Hub client module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and operations"]
  node_installer["Installer"]
  node_dns["Domain and DNS"]
  node_panel["Panel setup"]
  node_healthcheck["Healthcheck"]
  node_backup["Backup and restore"]
  node_upgrade["Script upgrade"]
  node_tunnel["Panel tunnel"]
end

subgraph group_network["Network services"]
  node_nginx["Nginx and decoys"]
  node_xray["Xray Reality"]
  node_hysteria["Hysteria2"]
  node_firewall["Firewall and fail2ban"]
  node_certs["Certificates"]
  node_xhttp["XHTTP entry"]
end

subgraph group_access["Client access"]
  node_awg["AmneziaWG"]
  node_subscriptions["Subscriptions"]
  node_clients["Client apps"]
end

subgraph group_automation["Optional automation"]
  node_telegram["Telegram bot"]
  node_hubbot["Hub bot tools<br/>[tgbot-hub.sh]"]
  node_hubclients["Hub client module<br/>[hub-clients.sh]"]
  node_patcher["Hub patcher<br/>[patch-hub.py]"]
end

node_admin(("Administrator"))

node_admin -->|"prepares domains"| node_dns
node_admin -->|"runs install"| node_installer
node_installer -->|"configures"| node_nginx
node_installer -->|"configures"| node_xray
node_installer -->|"configures"| node_hysteria
node_installer -->|"configures"| node_firewall
node_installer -->|"creates"| node_certs
node_installer -->|"creates"| node_subscriptions
node_installer -->|"enables"| node_awg
node_installer -.->|"optionally configures"| node_xhttp
node_admin -->|"completes setup"| node_panel
node_admin -->|"runs checks"| node_healthcheck
node_admin -->|"backs up or restores"| node_backup
node_admin -->|"runs upgrade"| node_upgrade
node_admin -->|"opens panel tunnel"| node_tunnel
node_admin -->|"shares subscription"| node_subscriptions
node_subscriptions -->|"client imports"| node_clients
node_admin -.->|"optionally enables"| node_telegram
node_patcher -->|"patches copy"| node_hubbot
node_hubbot -->|"loads module"| node_hubclients

click node_installer "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_healthcheck "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_backup "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_upgrade "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_tunnel "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_nginx "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_xray "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_hysteria "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_firewall "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_certs "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_xhttp "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_awg "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_subscriptions "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_telegram "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh"
click node_hubbot "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/tgbot-hub.sh"
click node_hubclients "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/hub-clients.sh"
click node_patcher "https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/patch-hub.py"

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_installer,node_dns,node_panel,node_healthcheck,node_backup,node_upgrade,node_tunnel toneBlue
class node_nginx,node_xray,node_hysteria,node_firewall,node_certs,node_xhttp toneAmber
class node_awg,node_subscriptions,node_clients toneMint
class node_telegram,node_hubbot,node_hubclients,node_patcher toneRose
class node_admin toneIndigo
```

## Components

### Setup and operations

- [Installer](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- **Domain and DNS**
- **Panel setup**
- [Healthcheck](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Backup and restore](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Script upgrade](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Panel tunnel](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`

### Network services

- [Nginx and decoys](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Xray Reality](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Hysteria2](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Firewall and fail2ban](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Certificates](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [XHTTP entry](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`

### Client access

- [AmneziaWG](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Subscriptions](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- **Client apps**

### Optional automation

- [Telegram bot](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/3x-ui-dual-domain.sh): `3x-ui-dual-domain.sh`
- [Hub bot tools](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/tgbot-hub.sh): `tools/hub/tgbot-hub.sh`
- [Hub client module](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/hub-clients.sh): `tools/hub/hub-clients.sh`
- [Hub patcher](https://github.com/shepard86rus/3x-ui-dual-domain/blob/main/tools/hub/patch-hub.py): `tools/hub/patch-hub.py`

### Other components

- **Administrator**

## Connections

- Administrator → Domain and DNS: prepares domains (evidence: `README.md`)
- Administrator → Installer: runs install (evidence: `README.md`)
- Installer → Nginx and decoys: configures (evidence: `README.md`)
- Installer → Xray Reality: configures (evidence: `README.md`)
- Installer → Hysteria2: configures (evidence: `README.md`)
- Installer → Firewall and fail2ban: configures (evidence: `README.md`)
- Installer → Certificates: creates (evidence: `README.md`)
- Installer → Subscriptions: creates (evidence: `README.md`)
- Installer → AmneziaWG: enables (evidence: `README.md`)
- Installer → XHTTP entry: optionally configures (evidence: `README.md`)
- Administrator → Panel setup: completes setup (evidence: `README.md`)
- Administrator → Healthcheck: runs checks (evidence: `README.md`)
- Administrator → Backup and restore: backs up or restores (evidence: `README.md`)
- Administrator → Script upgrade: runs upgrade (evidence: `README.md`)
- Administrator → Panel tunnel: opens panel tunnel (evidence: `README.md`)
- Administrator → Subscriptions: shares subscription (evidence: `README.md`)
- Subscriptions → Client apps: client imports (evidence: `README.md`)
- Administrator → Telegram bot: optionally enables (evidence: `README.md`)
- Hub patcher → Hub bot tools: patches copy (evidence: `tools/hub/patch-hub.py`)
- Hub bot tools → Hub client module: loads module
