# i3believe/mcws architecture

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

- Interactive diagram: https://gitdiagram.com/i3believe/mcws
- Repository: https://github.com/i3believe/mcws

## Overview

MCWS_v2 is a web control panel for managing Minecraft server instances, users, and shared server files. The principal workflow is an operator using the interactive web UI to manage a server slot: the manager persists slot state, prepares its working directory, and starts or controls a Java process. Separate capabilities cover account approval and roles, addon/world storage and installation, audit history, and host memory metrics. The excerpts establish backend service calls and persistence; page-to-service wiring and some subsystem details are not shown, so those links are omitted or marked unverified.

Main entry points: [`Program.cs`](https://github.com/i3believe/mcws/blob/main/Program.cs) (Interactive web host), [`Services/ServerInstanceManager.cs`](https://github.com/i3believe/mcws/blob/main/Services/ServerInstanceManager.cs) (Instance manager), [`Services/AddonService.cs`](https://github.com/i3believe/mcws/blob/main/Services/AddonService.cs) (Addon service), [`Data/AppDbContext.cs`](https://github.com/i3believe/mcws/blob/main/Data/AppDbContext.cs) (SQLite data context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["Interactive web host<br/>[Program.cs]"]
  node_server_ui["Server controls<br/>[Home.razor]"]
  node_storage_ui["Storage controls<br/>[Storage.razor]"]
  node_admin_ui["Admin controls<br/>[Admin.razor]"]
  node_login_ui["Login and registration<br/>[Login.razor]"]
end

subgraph group_accounts["Accounts and audit"]
  node_auth["Authentication service<br/>[AuthService.cs]"]
  node_auth_state["Session auth state"]
  node_user_model["User and roles<br/>[User.cs]"]
  node_audit_model["Audit records<br/>[AuditLog.cs]"]
  node_db[("SQLite data context<br/>[AppDbContext.cs]")]
end

subgraph group_servers["Server operations"]
  node_manager["Instance manager"]
  node_process["Java process control<br/>[ServerProcess.cs]"]
  node_instance_model["Server instance state<br/>[ServerInstance.cs]"]
  node_metrics["Host RAM metrics"]
end

subgraph group_files["Storage and addons"]
  node_addon["Addon service<br/>[AddonService.cs]"]
  node_storage["File and world storage<br/>[StorageService.cs]"]
  node_storage_models["Storage metadata<br/>[StorageModels.cs]"]
  node_result_codes["Operation result codes<br/>[ResultCode.cs]"]
  node_result_mapper["Result messages"]
end

node_operator(("Operator"))
node_admin_user(("Admin user"))

node_operator -->|"uses"| node_app
node_admin_user -->|"uses"| node_app
node_app -->|"configures"| node_db
node_app -->|"registers"| node_auth
node_app -->|"registers"| node_auth_state
node_app -->|"registers"| node_addon
node_app -->|"registers"| node_manager
node_app -->|"registers"| node_storage
node_app -->|"registers"| node_metrics
node_app -->|"hosts"| node_server_ui
node_login_ui -.->|"uses"| node_auth
node_admin_ui -.->|"uses"| node_auth
node_auth -->|"reads and writes"| node_db
node_auth_state -->|"restores user"| node_db
node_auth_state -->|"loads"| node_user_model
node_manager -->|"reads and writes"| node_db
node_manager -->|"prepares files"| node_storage
node_manager -->|"starts and controls"| node_process
node_manager -.->|"uses"| node_metrics
node_manager -->|"loads and updates"| node_instance_model
node_addon -->|"reads and writes"| node_db
node_addon -->|"manages files"| node_storage
node_addon -->|"checks server state"| node_manager
node_storage_ui -.->|"uses"| node_addon
node_storage_ui -.->|"uses"| node_storage

click node_app "https://github.com/i3believe/mcws/blob/main/Program.cs"
click node_server_ui "https://github.com/i3believe/mcws/blob/main/Components/Pages/Home.razor"
click node_storage_ui "https://github.com/i3believe/mcws/blob/main/Components/Pages/Storage.razor"
click node_admin_ui "https://github.com/i3believe/mcws/blob/main/Components/Pages/Admin.razor"
click node_login_ui "https://github.com/i3believe/mcws/blob/main/Components/Pages/Login.razor"
click node_auth "https://github.com/i3believe/mcws/blob/main/Services/AuthService.cs"
click node_auth_state "https://github.com/i3believe/mcws/blob/main/Services/AuthStateService.cs"
click node_user_model "https://github.com/i3believe/mcws/blob/main/Models/User.cs"
click node_audit_model "https://github.com/i3believe/mcws/blob/main/Models/AuditLog.cs"
click node_db "https://github.com/i3believe/mcws/blob/main/Data/AppDbContext.cs"
click node_manager "https://github.com/i3believe/mcws/blob/main/Services/ServerInstanceManager.cs"
click node_process "https://github.com/i3believe/mcws/blob/main/Services/ServerProcess.cs"
click node_instance_model "https://github.com/i3believe/mcws/blob/main/Models/ServerInstance.cs"
click node_metrics "https://github.com/i3believe/mcws/blob/main/Services/SystemMetricsService.cs"
click node_addon "https://github.com/i3believe/mcws/blob/main/Services/AddonService.cs"
click node_storage "https://github.com/i3believe/mcws/blob/main/Services/StorageService.cs"
click node_storage_models "https://github.com/i3believe/mcws/blob/main/Models/StorageModels.cs"
click node_result_codes "https://github.com/i3believe/mcws/blob/main/Models/ResultCode.cs"
click node_result_mapper "https://github.com/i3believe/mcws/blob/main/Services/ResultCodeMapper.cs"

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_app,node_server_ui,node_storage_ui,node_admin_ui,node_login_ui,node_admin_user toneBlue
class node_auth,node_auth_state,node_user_model,node_audit_model,node_db toneAmber
class node_manager,node_process,node_instance_model,node_metrics toneMint
class node_addon,node_storage,node_storage_models,node_result_codes,node_result_mapper toneRose
class node_operator toneIndigo
```

## Components

### Web interface

- [Interactive web host](https://github.com/i3believe/mcws/blob/main/Program.cs): `Program.cs`
- [Server controls](https://github.com/i3believe/mcws/blob/main/Components/Pages/Home.razor): `Components/Pages/Home.razor`
- [Storage controls](https://github.com/i3believe/mcws/blob/main/Components/Pages/Storage.razor): `Components/Pages/Storage.razor`
- [Admin controls](https://github.com/i3believe/mcws/blob/main/Components/Pages/Admin.razor): `Components/Pages/Admin.razor`
- [Login and registration](https://github.com/i3believe/mcws/blob/main/Components/Pages/Login.razor): `Components/Pages/Login.razor`

### Accounts and audit

- [Authentication service](https://github.com/i3believe/mcws/blob/main/Services/AuthService.cs): `Services/AuthService.cs`
- [Session auth state](https://github.com/i3believe/mcws/blob/main/Services/AuthStateService.cs): `Services/AuthStateService.cs`
- [User and roles](https://github.com/i3believe/mcws/blob/main/Models/User.cs): `Models/User.cs`
- [Audit records](https://github.com/i3believe/mcws/blob/main/Models/AuditLog.cs): `Models/AuditLog.cs`
- [SQLite data context](https://github.com/i3believe/mcws/blob/main/Data/AppDbContext.cs): `Data/AppDbContext.cs`

### Server operations

- [Instance manager](https://github.com/i3believe/mcws/blob/main/Services/ServerInstanceManager.cs): `Services/ServerInstanceManager.cs`
- [Java process control](https://github.com/i3believe/mcws/blob/main/Services/ServerProcess.cs): `Services/ServerProcess.cs`
- [Server instance state](https://github.com/i3believe/mcws/blob/main/Models/ServerInstance.cs): `Models/ServerInstance.cs`
- [Host RAM metrics](https://github.com/i3believe/mcws/blob/main/Services/SystemMetricsService.cs): `Services/SystemMetricsService.cs`

### Storage and addons

- [Addon service](https://github.com/i3believe/mcws/blob/main/Services/AddonService.cs): `Services/AddonService.cs`
- [File and world storage](https://github.com/i3believe/mcws/blob/main/Services/StorageService.cs): `Services/StorageService.cs`
- [Storage metadata](https://github.com/i3believe/mcws/blob/main/Models/StorageModels.cs): `Models/StorageModels.cs`
- [Operation result codes](https://github.com/i3believe/mcws/blob/main/Models/ResultCode.cs): `Models/ResultCode.cs`
- [Result messages](https://github.com/i3believe/mcws/blob/main/Services/ResultCodeMapper.cs): `Services/ResultCodeMapper.cs`

### Other components

- **Operator**
- **Admin user**

## Connections

- Operator → Interactive web host: uses (evidence: `Program.cs`)
- Admin user → Interactive web host: uses (evidence: `Program.cs`)
- Interactive web host → SQLite data context: configures (evidence: `Program.cs`)
- Interactive web host → Authentication service: registers (evidence: `Program.cs`)
- Interactive web host → Session auth state: registers (evidence: `Program.cs`)
- Interactive web host → Addon service: registers (evidence: `Program.cs`)
- Interactive web host → Instance manager: registers (evidence: `Program.cs`)
- Interactive web host → File and world storage: registers (evidence: `Program.cs`)
- Interactive web host → Host RAM metrics: registers (evidence: `Program.cs`)
- Interactive web host → Server controls: hosts (evidence: `Program.cs`)
- Login and registration → Authentication service: uses
- Admin controls → Authentication service: uses
- Authentication service → SQLite data context: reads and writes (evidence: `Services/AuthService.cs`)
- Session auth state → SQLite data context: restores user (evidence: `Services/AuthStateService.cs`)
- Session auth state → User and roles: loads (evidence: `Services/AuthStateService.cs`)
- Instance manager → SQLite data context: reads and writes (evidence: `Services/ServerInstanceManager.cs`)
- Instance manager → File and world storage: prepares files (evidence: `Services/ServerInstanceManager.cs`)
- Instance manager → Java process control: starts and controls (evidence: `Services/ServerInstanceManager.cs`)
- Instance manager → Host RAM metrics: uses (evidence: `Services/ServerInstanceManager.cs`)
- Instance manager → Server instance state: loads and updates (evidence: `Services/ServerInstanceManager.cs`)
- Addon service → SQLite data context: reads and writes (evidence: `Services/AddonService.cs`)
- Addon service → File and world storage: manages files (evidence: `Services/AddonService.cs`)
- Addon service → Instance manager: checks server state (evidence: `Services/AddonService.cs`)
- Storage controls → Addon service: uses
- Storage controls → File and world storage: uses
