# loganrundle-1/server-management-bot architecture

> Architecture diagram of the GitHub repository loganrundle-1/server-management-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/loganrundle-1/server-management-bot
- Repository: https://github.com/loganrundle-1/server-management-bot

## Overview

Server Management Discord Bot exposes host and VPS administration through Discord slash commands. A Discord user initiates commands handled in start.py, which dispatches to local.py for FRP, Docker, system, and script operations or to vps.py for remote firewall changes over SSH. Port management spans local FRP configuration and VPS iptables; script operations use SSH to reach the configured server. The README documents additional command capabilities whose detailed wiring is not visible in the sampled excerpts, so those links are shown only at the subsystem level.

Main entry points: [`start.py`](https://github.com/loganrundle-1/server-management-bot/blob/main/start.py) (Slash commands), [`vps.py`](https://github.com/loganrundle-1/server-management-bot/blob/main/vps.py) (VPS firewall), [`local.py`](https://github.com/loganrundle-1/server-management-bot/blob/main/local.py) (Local port utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discord["Discord Interface"]
  node_commands["Slash commands<br/>[start.py]"]
  node_general["General commands<br/>[start.py]"]
end

subgraph group_network["Port Management"]
  node_ports["Port commands<br/>[start.py]"]
  node_vps_firewall["VPS firewall<br/>[vps.py]"]
  node_vps_rules["VPS iptables rules<br/>[vps.py]"]
  node_frp_ports["FRP port config<br/>[local.py]"]
  node_local_ports["Local port utilities<br/>[local.py]"]
end

subgraph group_host["Host Operations"]
  node_docker["Docker controls<br/>[local.py]"]
  node_docker_host[("Docker host")]
  node_system["System monitoring<br/>[local.py]"]
  node_system_host[("Local system")]
end

subgraph group_scripts["Script Management"]
  node_script_commands["Script commands<br/>[start.py]"]
  node_script_ops["Script operations<br/>[local.py]"]
  node_server_ssh["Server SSH<br/>[local.py]"]
  node_managed_server[("Managed server")]
end

node_user(("Discord user"))
node_discord_platform(("Discord platform"))

node_user -->|"invokes"| node_commands
node_commands -->|"syncs commands"| node_discord_platform
node_general -->|"responds through"| node_discord_platform
node_commands -->|"dispatches"| node_general
node_commands -->|"dispatches"| node_ports
node_commands -->|"dispatches"| node_script_commands
node_ports -->|"calls"| node_vps_firewall
node_ports -->|"calls"| node_local_ports
node_vps_firewall -->|"reads and updates"| node_vps_rules
node_vps_firewall -->|"SSH commands"| node_managed_server
node_local_ports -->|"reads and updates"| node_frp_ports
node_local_ports -->|"restarts FRP"| node_docker
node_script_commands -->|"calls"| node_script_ops
node_script_ops -->|"executes via"| node_server_ssh
node_server_ssh -->|"runs commands"| node_managed_server
node_commands -->|"dispatches Docker operations"| node_docker
node_docker -->|"controls containers"| node_docker_host
node_commands -->|"dispatches monitoring"| node_system
node_system -->|"reads metrics"| node_system_host

click node_commands "https://github.com/loganrundle-1/server-management-bot/blob/main/start.py"
click node_general "https://github.com/loganrundle-1/server-management-bot/blob/main/start.py"
click node_ports "https://github.com/loganrundle-1/server-management-bot/blob/main/start.py"
click node_vps_firewall "https://github.com/loganrundle-1/server-management-bot/blob/main/vps.py"
click node_vps_rules "https://github.com/loganrundle-1/server-management-bot/blob/main/vps.py"
click node_frp_ports "https://github.com/loganrundle-1/server-management-bot/blob/main/local.py"
click node_local_ports "https://github.com/loganrundle-1/server-management-bot/blob/main/local.py"
click node_docker "https://github.com/loganrundle-1/server-management-bot/blob/main/local.py"
click node_system "https://github.com/loganrundle-1/server-management-bot/blob/main/local.py"
click node_script_commands "https://github.com/loganrundle-1/server-management-bot/blob/main/start.py"
click node_script_ops "https://github.com/loganrundle-1/server-management-bot/blob/main/local.py"
click node_server_ssh "https://github.com/loganrundle-1/server-management-bot/blob/main/local.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_commands,node_general,node_user toneBlue
class node_ports,node_vps_firewall,node_vps_rules,node_frp_ports,node_local_ports toneAmber
class node_docker,node_docker_host,node_system,node_system_host toneMint
class node_script_commands,node_script_ops,node_server_ssh,node_managed_server toneRose
class node_discord_platform toneIndigo
```

## Components

### Discord Interface

- [Slash commands](https://github.com/loganrundle-1/server-management-bot/blob/main/start.py): `start.py`
- [General commands](https://github.com/loganrundle-1/server-management-bot/blob/main/start.py): `start.py`

### Port Management

- [Port commands](https://github.com/loganrundle-1/server-management-bot/blob/main/start.py): `start.py`
- [VPS firewall](https://github.com/loganrundle-1/server-management-bot/blob/main/vps.py): `vps.py`
- [VPS iptables rules](https://github.com/loganrundle-1/server-management-bot/blob/main/vps.py): `vps.py`
- [FRP port config](https://github.com/loganrundle-1/server-management-bot/blob/main/local.py): `local.py`
- [Local port utilities](https://github.com/loganrundle-1/server-management-bot/blob/main/local.py): `local.py`

### Host Operations

- [Docker controls](https://github.com/loganrundle-1/server-management-bot/blob/main/local.py): `local.py`
- **Docker host**
- [System monitoring](https://github.com/loganrundle-1/server-management-bot/blob/main/local.py): `local.py`
- **Local system**

### Script Management

- [Script commands](https://github.com/loganrundle-1/server-management-bot/blob/main/start.py): `start.py`
- [Script operations](https://github.com/loganrundle-1/server-management-bot/blob/main/local.py): `local.py`
- [Server SSH](https://github.com/loganrundle-1/server-management-bot/blob/main/local.py): `local.py`
- **Managed server**

### Other components

- **Discord user**
- **Discord platform**

## Connections

- Discord user → Slash commands: invokes
- Slash commands → Discord platform: syncs commands
- General commands → Discord platform: responds through
- Slash commands → General commands: dispatches
- Slash commands → Port commands: dispatches
- Slash commands → Script commands: dispatches
- Port commands → VPS firewall: calls
- Port commands → Local port utilities: calls
- VPS firewall → VPS iptables rules: reads and updates
- VPS firewall → Managed server: SSH commands
- Local port utilities → FRP port config: reads and updates
- Local port utilities → Docker controls: restarts FRP
- Script commands → Script operations: calls
- Script operations → Server SSH: executes via
- Server SSH → Managed server: runs commands
- Slash commands → Docker controls: dispatches Docker operations
- Docker controls → Docker host: controls containers
- Slash commands → System monitoring: dispatches monitoring
- System monitoring → Local system: reads metrics
