# mrkinte/u-fanctl architecture

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

- Interactive diagram: https://gitdiagram.com/mrkinte/u-fanctl
- Repository: https://github.com/mrkinte/u-fanctl
- Video tour (about a minute): https://gitdiagram.com/mrkinte/u-fanctl/video

## Overview

U-Fanctl is a web-based fan controller for the HS-201P NAS: an operator logs in, selects manual speed or automatic temperature-curve control, and monitors fan status. The Python service initializes configuration and fan control, schedules automatic regulation, and serves authenticated APIs, WebSocket updates, and the Vue interface. The README documents temperature curves; sampled files do not show the regulation, configuration-route, or WebSocket implementations, so those links are limited to documented roles and visible entry points.

Main entry points: [`U-Fanctl/services/web_service.py`](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/services/web_service.py) (HTTP application), [`WebUI/src/views/ControlView.vue`](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/views/ControlView.vue) (Control dashboard), [`U-Fanctl/utils/config_manager.py`](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/utils/config_manager.py) (Config manager), [`U-Fanctl/main.py`](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/main.py) (Service startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_app["Application shell<br/>[App.vue]"]
  node_router["Page routing<br/>[index.ts]"]
  node_login_view["Login page<br/>[LogInView.vue]"]
  node_control_view["Control dashboard<br/>[ControlView.vue]"]
  node_control_mode["Mode and speed<br/>[ControlMode.vue]"]
  node_curve_chart["Curve and telemetry<br/>[ControlCurve.vue]"]
  node_temperature_chart["Temperature chart"]
  node_auth_api["Auth API client<br/>[auth.ts]"]
  node_config_api["Config API client<br/>[config.ts]"]
end

subgraph group_api["Web service"]
  node_web_service["HTTP application<br/>[web_service.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_config_routes["Configuration routes<br/>[config.py]"]
  node_websocket_routes["Live updates<br/>[websocket.py]"]
  node_schemas["Response models"]
end

subgraph group_control["Fan control"]
  node_main["Service startup<br/>[main.py]"]
  node_fan_control["Fan regulation<br/>[fan_control.py]"]
end

subgraph group_state["Configuration and session"]
  node_session["Session manager<br/>[session_manager.py]"]
  node_config_manager["Config manager<br/>[config_manager.py]"]
  node_config_file[("TOML settings")]
end

node_operator(("Operator"))
node_browser(("Browser"))
node_i2c{{"NAS fan hardware"}}

node_operator -->|"operates"| node_browser
node_browser -->|"opens"| node_app
node_app -->|"renders routes"| node_router
node_router -->|"selects"| node_login_view
node_router -->|"selects"| node_control_view
node_login_view -->|"submits login"| node_auth_api
node_control_view -->|"shows controls"| node_control_mode
node_control_view -->|"shows curve"| node_curve_chart
node_control_view -->|"shows telemetry"| node_temperature_chart
node_control_mode -->|"reads and sets"| node_config_api
node_curve_chart -->|"reads and sets"| node_config_api
node_auth_api -->|"HTTP requests"| node_web_service
node_config_api -->|"HTTP requests"| node_web_service
node_web_service -->|"routes auth"| node_auth_routes
node_web_service -->|"routes config"| node_config_routes
node_web_service -->|"routes updates"| node_websocket_routes
node_web_service -->|"formats errors"| node_schemas
node_auth_routes -->|"creates and checks"| node_session
node_auth_routes -->|"reads password"| node_config_manager
node_config_routes -->|"reads and writes"| node_config_manager
node_web_service -->|"checks protected routes"| node_session
node_main -->|"initializes settings"| node_config_manager
node_main -->|"initializes and regulates"| node_fan_control
node_main -->|"serves application"| node_web_service
node_fan_control -->|"controls fan"| node_i2c
node_config_manager -->|"loads and saves"| node_config_file

click node_app "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/App.vue"
click node_router "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/router/index.ts"
click node_login_view "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/views/LogInView.vue"
click node_control_view "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/views/ControlView.vue"
click node_control_mode "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/components/ControlMode.vue"
click node_curve_chart "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/components/ControlCurve.vue"
click node_temperature_chart "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/components/TemperatureChart.vue"
click node_auth_api "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/apis/auth.ts"
click node_config_api "https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/apis/config.ts"
click node_web_service "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/services/web_service.py"
click node_auth_routes "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/routers/auth.py"
click node_config_routes "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/routers/config.py"
click node_websocket_routes "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/routers/websocket.py"
click node_schemas "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/models/response_schemas.py"
click node_main "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/main.py"
click node_fan_control "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/services/fan_control.py"
click node_session "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/services/session_manager.py"
click node_config_manager "https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/utils/config_manager.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_app,node_router,node_login_view,node_control_view,node_control_mode,node_curve_chart,node_temperature_chart,node_auth_api,node_config_api,node_browser toneBlue
class node_web_service,node_auth_routes,node_config_routes,node_websocket_routes,node_schemas toneAmber
class node_main,node_fan_control toneMint
class node_session,node_config_manager,node_config_file toneRose
class node_operator,node_i2c toneIndigo
```

## Components

### Web interface

- [Application shell](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/App.vue): `WebUI/src/App.vue`
- [Page routing](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/router/index.ts): `WebUI/src/router/index.ts`
- [Login page](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/views/LogInView.vue): `WebUI/src/views/LogInView.vue`
- [Control dashboard](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/views/ControlView.vue): `WebUI/src/views/ControlView.vue`
- [Mode and speed](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/components/ControlMode.vue): `WebUI/src/components/ControlMode.vue`
- [Curve and telemetry](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/components/ControlCurve.vue): `WebUI/src/components/ControlCurve.vue`
- [Temperature chart](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/components/TemperatureChart.vue): `WebUI/src/components/TemperatureChart.vue`
- [Auth API client](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/apis/auth.ts): `WebUI/src/apis/auth.ts`
- [Config API client](https://github.com/mrkinte/u-fanctl/blob/main/WebUI/src/apis/config.ts): `WebUI/src/apis/config.ts`

### Web service

- [HTTP application](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/services/web_service.py): `U-Fanctl/services/web_service.py`
- [Authentication routes](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/routers/auth.py): `U-Fanctl/routers/auth.py`
- [Configuration routes](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/routers/config.py): `U-Fanctl/routers/config.py`
- [Live updates](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/routers/websocket.py): `U-Fanctl/routers/websocket.py`
- [Response models](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/models/response_schemas.py): `U-Fanctl/models/response_schemas.py`

### Fan control

- [Service startup](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/main.py): `U-Fanctl/main.py`
- [Fan regulation](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/services/fan_control.py): `U-Fanctl/services/fan_control.py`

### Configuration and session

- [Session manager](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/services/session_manager.py): `U-Fanctl/services/session_manager.py`
- [Config manager](https://github.com/mrkinte/u-fanctl/blob/main/U-Fanctl/utils/config_manager.py): `U-Fanctl/utils/config_manager.py`
- **TOML settings**

### Other components

- **Operator**
- **Browser**
- **NAS fan hardware**

## Connections

- Operator → Browser: operates
- Browser → Application shell: opens
- Application shell → Page routing: renders routes
- Page routing → Login page: selects
- Page routing → Control dashboard: selects
- Login page → Auth API client: submits login
- Control dashboard → Mode and speed: shows controls
- Control dashboard → Curve and telemetry: shows curve
- Control dashboard → Temperature chart: shows telemetry
- Mode and speed → Config API client: reads and sets
- Curve and telemetry → Config API client: reads and sets
- Auth API client → HTTP application: HTTP requests
- Config API client → HTTP application: HTTP requests
- HTTP application → Authentication routes: routes auth
- HTTP application → Configuration routes: routes config
- HTTP application → Live updates: routes updates
- HTTP application → Response models: formats errors
- Authentication routes → Session manager: creates and checks
- Authentication routes → Config manager: reads password
- Configuration routes → Config manager: reads and writes
- HTTP application → Session manager: checks protected routes
- Service startup → Config manager: initializes settings
- Service startup → Fan regulation: initializes and regulates
- Service startup → HTTP application: serves application
- Fan regulation → NAS fan hardware: controls fan
- Config manager → TOML settings: loads and saves
