# mcroitor/qemu-manager architecture

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

- Interactive diagram: https://gitdiagram.com/mcroitor/qemu-manager
- Repository: https://github.com/mcroitor/qemu-manager

## Overview

QEMU Manager is a PHP web GUI for administering QEMU disk images, virtual machines, and networking. A browser request enters through the front controller, which builds navigation and renders the routed response; users can bootstrap an administrator, then authenticate for protected management areas. The QEMU modules provide distinct image, machine, and network workflows, backed by SQLite and QEMU command-line tools. The graph follows explicit calls and README claims; some router dispatch details and unsampled module behavior are shown only as unverified where useful.

Main entry points: [`src/modules/qemu/machine.php`](https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/machine.php) (Virtual machine management), [`src/core/mc/router.php`](https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/router.php) (Route dispatcher), [`src/modules/qemu/image.php`](https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/image.php) (Disk image management), [`src/index.php`](https://github.com/mcroitor/qemu-manager/blob/main/src/index.php) (Request front controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry and rendering"]
  node_front["Request front controller<br/>[index.php]"]
  node_router["Route dispatcher<br/>[router.php]"]
  node_page["Page renderer<br/>[page.php]"]
end

subgraph group_identity["Authentication"]
  node_auth["Authentication and roles<br/>[auth.php]"]
  node_users["User management<br/>[user.php]"]
end

subgraph group_qemu["QEMU management"]
  node_images["Disk image management<br/>[image.php]"]
  node_machines["Virtual machine management<br/>[machine.php]"]
  node_networks["Network and forwarding<br/>[network.php]"]
  node_hardware["Machine architecture options<br/>[architecture.php]"]
  node_container["Container module<br/>[container.php]"]
end

subgraph group_core["Application core"]
  node_templates["Template renderer<br/>[template.php]"]
  node_database[("SQLite database<br/>[database.php]")]
  node_validator["Input validation<br/>[validator.php]"]
  node_utilities["Command and path utilities<br/>[util.php]"]
end

node_browser(("Browser user"))
node_qemu_cli["QEMU command-line tools"]

node_browser -->|"requests"| node_front
node_front -->|"dispatches"| node_router
node_front -->|"checks session"| node_auth
node_front -->|"renders response"| node_page
node_page -->|"fills layout"| node_templates
node_front -->|"reads settings"| node_database
node_router -.->|"routes auth requests"| node_auth
node_router -.->|"routes image requests"| node_images
node_router -.->|"routes VM requests"| node_machines
node_router -.->|"routes network requests"| node_networks
node_auth -.->|"manages accounts"| node_users
node_images -.->|"stores image metadata"| node_database
node_images -->|"renders views"| node_templates
node_images -->|"runs helpers"| node_utilities
node_images -->|"runs qemu-img"| node_qemu_cli
node_machines -->|"reads and writes"| node_database
node_machines -->|"lists images"| node_images
node_machines -->|"uses architectures"| node_hardware
node_machines -->|"runs commands"| node_utilities
node_machines -->|"starts and stops VMs"| node_qemu_cli
node_networks -->|"reads and writes"| node_database
node_networks -->|"renders views"| node_templates
node_networks -->|"resolves templates"| node_utilities
node_machines -->|"validates input"| node_validator
node_networks -.->|"validates input"| node_validator
node_container -.->|"registers module"| node_router

click node_front "https://github.com/mcroitor/qemu-manager/blob/main/src/index.php"
click node_router "https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/router.php"
click node_page "https://github.com/mcroitor/qemu-manager/blob/main/src/core/page.php"
click node_templates "https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/template.php"
click node_auth "https://github.com/mcroitor/qemu-manager/blob/main/src/core/auth.php"
click node_users "https://github.com/mcroitor/qemu-manager/blob/main/src/core/user.php"
click node_images "https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/image.php"
click node_machines "https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/machine.php"
click node_networks "https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/network.php"
click node_hardware "https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/hardware/architecture.php"
click node_container "https://github.com/mcroitor/qemu-manager/blob/main/src/modules/container/container.php"
click node_database "https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/database.php"
click node_validator "https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/validator.php"
click node_utilities "https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/util.php"

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_front,node_router,node_page,node_browser toneBlue
class node_auth,node_users toneAmber
class node_images,node_machines,node_networks,node_hardware,node_container toneMint
class node_templates,node_database,node_validator,node_utilities toneRose
class node_qemu_cli toneIndigo
```

## Components

### Web entry and rendering

- [Request front controller](https://github.com/mcroitor/qemu-manager/blob/main/src/index.php): `src/index.php`
- [Route dispatcher](https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/router.php): `src/core/mc/router.php`
- [Page renderer](https://github.com/mcroitor/qemu-manager/blob/main/src/core/page.php): `src/core/page.php`

### Authentication

- [Authentication and roles](https://github.com/mcroitor/qemu-manager/blob/main/src/core/auth.php): `src/core/auth.php`
- [User management](https://github.com/mcroitor/qemu-manager/blob/main/src/core/user.php): `src/core/user.php`

### QEMU management

- [Disk image management](https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/image.php): `src/modules/qemu/image.php`
- [Virtual machine management](https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/machine.php): `src/modules/qemu/machine.php`
- [Network and forwarding](https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/network.php): `src/modules/qemu/network.php`
- [Machine architecture options](https://github.com/mcroitor/qemu-manager/blob/main/src/modules/qemu/hardware/architecture.php): `src/modules/qemu/hardware/architecture.php`
- [Container module](https://github.com/mcroitor/qemu-manager/blob/main/src/modules/container/container.php): `src/modules/container/container.php`

### Application core

- [Template renderer](https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/template.php): `src/core/mc/template.php`
- [SQLite database](https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/database.php): `src/core/mc/database.php`
- [Input validation](https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/validator.php): `src/core/mc/validator.php`
- [Command and path utilities](https://github.com/mcroitor/qemu-manager/blob/main/src/core/mc/util.php): `src/core/mc/util.php`

### Other components

- **Browser user**
- **QEMU command-line tools**

## Connections

- Browser user → Request front controller: requests
- Request front controller → Route dispatcher: dispatches (evidence: `src/index.php`)
- Request front controller → Authentication and roles: checks session (evidence: `src/index.php`)
- Request front controller → Page renderer: renders response (evidence: `src/index.php`)
- Page renderer → Template renderer: fills layout (evidence: `src/core/page.php`)
- Request front controller → SQLite database: reads settings (evidence: `src/index.php`)
- Route dispatcher → Authentication and roles: routes auth requests
- Route dispatcher → Disk image management: routes image requests
- Route dispatcher → Virtual machine management: routes VM requests
- Route dispatcher → Network and forwarding: routes network requests
- Authentication and roles → User management: manages accounts
- Disk image management → SQLite database: stores image metadata
- Disk image management → Template renderer: renders views (evidence: `src/modules/qemu/image.php`)
- Disk image management → Command and path utilities: runs helpers (evidence: `src/modules/qemu/image.php`)
- Disk image management → QEMU command-line tools: runs qemu-img (evidence: `src/modules/qemu/image.php`)
- Virtual machine management → SQLite database: reads and writes (evidence: `src/modules/qemu/machine.php`)
- Virtual machine management → Disk image management: lists images (evidence: `src/modules/qemu/machine.php`)
- Virtual machine management → Machine architecture options: uses architectures (evidence: `src/modules/qemu/machine.php`)
- Virtual machine management → Command and path utilities: runs commands (evidence: `src/modules/qemu/machine.php`)
- Virtual machine management → QEMU command-line tools: starts and stops VMs (evidence: `src/modules/qemu/machine.php`)
- Network and forwarding → SQLite database: reads and writes (evidence: `src/modules/qemu/network.php`)
- Network and forwarding → Template renderer: renders views (evidence: `src/modules/qemu/network.php`)
- Network and forwarding → Command and path utilities: resolves templates (evidence: `src/modules/qemu/network.php`)
- Virtual machine management → Input validation: validates input (evidence: `src/modules/qemu/machine.php`)
- Network and forwarding → Input validation: validates input
- Container module → Route dispatcher: registers module
