# mayerdev/nehost-backend architecture

> Architecture diagram of the GitHub repository mayerdev/nehost-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mayerdev/nehost-backend
- Repository: https://github.com/mayerdev/nehost-backend

## Overview

nehost-backend is a hosting-panel backend. Its principal workflow is a client request to service management, which validates the request, provisions or operates a virtual server through Proxmox/SSH, and updates account and infrastructure records. The tree also shows separate account/authentication, infrastructure administration, support, and billing areas. The README identifies the product only broadly, and several controller excerpts are incomplete, so relationships not visible in the excerpts or documented by the README are omitted.

Main entry points: [`controllers/Services.js`](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Services.js) (Virtual services), [`pay.js`](https://github.com/mayerdev/nehost-backend/blob/main/pay.js) (Recurring billing), [`controllers/Auth.js`](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Auth.js) (Authentication), [`utils/Verify.js`](https://github.com/mayerdev/nehost-backend/blob/main/utils/Verify.js) (Input validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Panel API"]
  node_auth["Authentication<br/>[Auth.js]"]
  node_account["Account<br/>[Account.js]"]
  node_services["Virtual services<br/>[Services.js]"]
  node_locations["Locations<br/>[Locations.js]"]
  node_nodes_api["Node administration<br/>[Nodes.js]"]
  node_operations_api["Operations API<br/>[Operations.js]"]
  node_ports_api["Port administration<br/>[Ports.js]"]
  node_subnets_api["Subnet administration<br/>[Subnets.js]"]
  node_tariffs_api["Tariffs<br/>[Vtariffs.js]"]
  node_users_api["User administration<br/>[Users.js]"]
  node_promo_api["Promotions<br/>[Promo.js]"]
end

subgraph group_infra["Infrastructure"]
  node_proxmox["Proxmox"]
  node_host_ssh["Host SSH"]
end

subgraph group_data["Persistent records"]
  node_mongo[("MongoDB")]
  node_user_model["User records<br/>[User.js]"]
  node_server_model["Virtual server records<br/>[Vserver.js]"]
  node_node_model["Node records<br/>[Node.js]"]
  node_other_models["Other records"]
end

subgraph group_ops["Operations and support"]
  node_abuse_api["Abuse handling<br/>[Abuse.js]"]
  node_support_api["Customer support<br/>[Support.js]"]
  node_admin_support["Support administration<br/>[Asupport.js]"]
  node_billing["Recurring billing<br/>[pay.js]"]
end

subgraph group_shared["Shared logic"]
  node_verify["Input validation<br/>[Verify.js]"]
  node_generators["Credential generation<br/>[Generators.js]"]
end

node_client(("Panel client"))

node_client -->|"sends requests"| node_auth
node_client -.->|"requests service actions"| node_services
node_auth -->|"reads and writes"| node_mongo
node_auth -->|"validates fields"| node_verify
node_account -->|"checks password"| node_verify
node_services -->|"checks passwords"| node_verify
node_services -->|"creates passwords"| node_generators
node_services -->|"reads and updates"| node_mongo
node_services -->|"manages containers"| node_proxmox
node_services -->|"runs host commands"| node_host_ssh
node_ports_api -->|"removes port rules"| node_host_ssh
node_ports_api -->|"reads and updates"| node_mongo
node_admin_support -->|"manages tickets"| node_mongo
node_billing -->|"charges accounts"| node_mongo
node_billing -->|"removes containers"| node_proxmox
node_billing -->|"connects to host"| node_host_ssh

click node_auth "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Auth.js"
click node_account "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Account.js"
click node_services "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Services.js"
click node_locations "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Locations.js"
click node_nodes_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Nodes.js"
click node_operations_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Operations.js"
click node_ports_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Ports.js"
click node_subnets_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Subnets.js"
click node_tariffs_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Vtariffs.js"
click node_users_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Users.js"
click node_promo_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Promo.js"
click node_abuse_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Abuse.js"
click node_support_api "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Support.js"
click node_admin_support "https://github.com/mayerdev/nehost-backend/blob/main/controllers/Asupport.js"
click node_billing "https://github.com/mayerdev/nehost-backend/blob/main/pay.js"
click node_user_model "https://github.com/mayerdev/nehost-backend/blob/main/models/mongo/User.js"
click node_server_model "https://github.com/mayerdev/nehost-backend/blob/main/models/mongo/Vserver.js"
click node_node_model "https://github.com/mayerdev/nehost-backend/blob/main/models/mongo/Node.js"
click node_other_models "https://github.com/mayerdev/nehost-backend/tree/main/models/mongo"
click node_verify "https://github.com/mayerdev/nehost-backend/blob/main/utils/Verify.js"
click node_generators "https://github.com/mayerdev/nehost-backend/blob/main/utils/Generators.js"

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_auth,node_account,node_services,node_locations,node_nodes_api,node_operations_api,node_ports_api,node_subnets_api,node_tariffs_api,node_users_api,node_promo_api,node_client toneBlue
class node_proxmox,node_host_ssh toneAmber
class node_mongo,node_user_model,node_server_model,node_node_model,node_other_models toneMint
class node_abuse_api,node_support_api,node_admin_support,node_billing toneRose
class node_verify,node_generators toneIndigo
```

## Components

### Panel API

- [Authentication](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Auth.js): `controllers/Auth.js`
- [Account](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Account.js): `controllers/Account.js`
- [Virtual services](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Services.js): `controllers/Services.js`
- [Locations](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Locations.js): `controllers/Locations.js`
- [Node administration](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Nodes.js): `controllers/Nodes.js`
- [Operations API](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Operations.js): `controllers/Operations.js`
- [Port administration](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Ports.js): `controllers/Ports.js`
- [Subnet administration](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Subnets.js): `controllers/Subnets.js`
- [Tariffs](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Vtariffs.js): `controllers/Vtariffs.js`
- [User administration](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Users.js): `controllers/Users.js`
- [Promotions](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Promo.js): `controllers/Promo.js`

### Infrastructure

- **Proxmox**
- **Host SSH**

### Persistent records

- **MongoDB**
- [User records](https://github.com/mayerdev/nehost-backend/blob/main/models/mongo/User.js): `models/mongo/User.js`
- [Virtual server records](https://github.com/mayerdev/nehost-backend/blob/main/models/mongo/Vserver.js): `models/mongo/Vserver.js`
- [Node records](https://github.com/mayerdev/nehost-backend/blob/main/models/mongo/Node.js): `models/mongo/Node.js`
- [Other records](https://github.com/mayerdev/nehost-backend/tree/main/models/mongo): `models/mongo`

### Operations and support

- [Abuse handling](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Abuse.js): `controllers/Abuse.js`
- [Customer support](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Support.js): `controllers/Support.js`
- [Support administration](https://github.com/mayerdev/nehost-backend/blob/main/controllers/Asupport.js): `controllers/Asupport.js`
- [Recurring billing](https://github.com/mayerdev/nehost-backend/blob/main/pay.js): `pay.js`

### Shared logic

- [Input validation](https://github.com/mayerdev/nehost-backend/blob/main/utils/Verify.js): `utils/Verify.js`
- [Credential generation](https://github.com/mayerdev/nehost-backend/blob/main/utils/Generators.js): `utils/Generators.js`

### Other components

- **Panel client**

## Connections

- Panel client → Authentication: sends requests (evidence: `controllers/Auth.js`)
- Panel client → Virtual services: requests service actions (evidence: `README.md`)
- Authentication → MongoDB: reads and writes (evidence: `controllers/Auth.js`)
- Authentication → Input validation: validates fields (evidence: `controllers/Auth.js`)
- Account → Input validation: checks password (evidence: `controllers/Account.js`)
- Virtual services → Input validation: checks passwords (evidence: `controllers/Services.js`)
- Virtual services → Credential generation: creates passwords (evidence: `controllers/Services.js`)
- Virtual services → MongoDB: reads and updates (evidence: `controllers/Services.js`)
- Virtual services → Proxmox: manages containers (evidence: `controllers/Services.js`)
- Virtual services → Host SSH: runs host commands (evidence: `controllers/Services.js`)
- Port administration → Host SSH: removes port rules (evidence: `controllers/Ports.js`)
- Port administration → MongoDB: reads and updates (evidence: `controllers/Ports.js`)
- Support administration → MongoDB: manages tickets (evidence: `controllers/Asupport.js`)
- Recurring billing → MongoDB: charges accounts (evidence: `pay.js`)
- Recurring billing → Proxmox: removes containers (evidence: `pay.js`)
- Recurring billing → Host SSH: connects to host (evidence: `pay.js`)
