# rufusshrestha/izone architecture

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

- Interactive diagram: https://gitdiagram.com/rufusshrestha/izone
- Repository: https://github.com/rufusshrestha/izone

## Overview

iZone CLI Controller provides command-line and local web control of Airstream iZone systems. The main workflow is user command → CLI dispatch → system, zone, or schedule operations → HTTP requests to the controller, with responses formatted for the user. A local web server provides a separate UI/API path, with password and session handling; service installation and local configuration support those entry points. The README also documents Coolbreeze, ventilation, and advanced configuration capabilities. Relationships reflect shown calls, source-index references, or README documentation; unsampled wiring is omitted.

Main entry points: [`src/main.rs`](https://github.com/rufusshrestha/izone/blob/main/src/main.rs) (CLI dispatch), [`src/api.rs`](https://github.com/rufusshrestha/izone/blob/main/src/api.rs) (Controller API), [`src/web.rs`](https://github.com/rufusshrestha/izone/blob/main/src/web.rs) (Web server and API), [`src/commands/system.rs`](https://github.com/rufusshrestha/izone/blob/main/src/commands/system.rs) (System controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_main["CLI dispatch<br/>[main.rs]"]
end

subgraph group_controller["Controller operations"]
  node_system["System controls<br/>[system.rs]"]
  node_zones["Zone controls<br/>[zones.rs]"]
  node_schedules["Schedules<br/>[schedules.rs]"]
  node_api["Controller API<br/>[api.rs]"]
end

subgraph group_web["Web control"]
  node_web["Web server and API<br/>[web.rs]"]
  node_web_ui["Web interface<br/>[web_ui.html]"]
  node_auth["Password handling<br/>[web_auth.rs]"]
  node_install["Service management<br/>[web_install.rs]"]
end

subgraph group_support["Configuration and security"]
  node_models["Response models<br/>[models.rs]"]
  node_helpers["Formatting helpers<br/>[helpers.rs]"]
  node_config["IP and zones<br/>[constants.rs]"]
end

node_cli_user(("CLI user"))
node_controller_device(("iZone controller"))
node_web_user(("Web user"))

node_cli_user -->|"runs commands"| node_main
node_main -->|"dispatches controls"| node_system
node_main -->|"dispatches zone actions"| node_zones
node_main -->|"dispatches schedules"| node_schedules
node_main -->|"starts web mode"| node_web
node_system -->|"sends requests"| node_api
node_zones -->|"queries controller"| node_api
node_schedules -->|"manages schedules"| node_api
node_api -->|"sends HTTP requests"| node_controller_device
node_web -->|"queries and commands"| node_api
node_web_user -->|"uses web controls"| node_web
node_web -.->|"serves interface"| node_web_ui
node_web -->|"checks sessions"| node_auth
node_install -->|"resets credentials"| node_auth
node_main -.->|"manages service"| node_install
node_main -->|"loads settings"| node_config
node_api -->|"uses controller address"| node_config
node_system -->|"formats output"| node_helpers
node_zones -->|"formats output"| node_helpers
node_schedules -->|"formats output"| node_helpers
node_system -->|"uses response types"| node_models
node_zones -->|"uses response types"| node_models
node_schedules -->|"uses schedule types"| node_models

click node_main "https://github.com/rufusshrestha/izone/blob/main/src/main.rs"
click node_system "https://github.com/rufusshrestha/izone/blob/main/src/commands/system.rs"
click node_zones "https://github.com/rufusshrestha/izone/blob/main/src/commands/zones.rs"
click node_schedules "https://github.com/rufusshrestha/izone/blob/main/src/commands/schedules.rs"
click node_api "https://github.com/rufusshrestha/izone/blob/main/src/api.rs"
click node_models "https://github.com/rufusshrestha/izone/blob/main/src/models.rs"
click node_helpers "https://github.com/rufusshrestha/izone/blob/main/src/helpers.rs"
click node_config "https://github.com/rufusshrestha/izone/blob/main/src/constants.rs"
click node_web "https://github.com/rufusshrestha/izone/blob/main/src/web.rs"
click node_web_ui "https://github.com/rufusshrestha/izone/blob/main/src/web_ui.html"
click node_auth "https://github.com/rufusshrestha/izone/blob/main/src/web_auth.rs"
click node_install "https://github.com/rufusshrestha/izone/blob/main/src/web_install.rs"

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_main,node_cli_user,node_web_user toneBlue
class node_system,node_zones,node_schedules,node_api toneAmber
class node_web,node_web_ui,node_auth,node_install toneMint
class node_models,node_helpers,node_config toneRose
class node_controller_device toneIndigo
```

## Components

### CLI workflow

- [CLI dispatch](https://github.com/rufusshrestha/izone/blob/main/src/main.rs): `src/main.rs`

### Controller operations

- [System controls](https://github.com/rufusshrestha/izone/blob/main/src/commands/system.rs): `src/commands/system.rs`
- [Zone controls](https://github.com/rufusshrestha/izone/blob/main/src/commands/zones.rs): `src/commands/zones.rs`
- [Schedules](https://github.com/rufusshrestha/izone/blob/main/src/commands/schedules.rs): `src/commands/schedules.rs`
- [Controller API](https://github.com/rufusshrestha/izone/blob/main/src/api.rs): `src/api.rs`

### Web control

- [Web server and API](https://github.com/rufusshrestha/izone/blob/main/src/web.rs): `src/web.rs`
- [Web interface](https://github.com/rufusshrestha/izone/blob/main/src/web_ui.html): `src/web_ui.html`
- [Password handling](https://github.com/rufusshrestha/izone/blob/main/src/web_auth.rs): `src/web_auth.rs`
- [Service management](https://github.com/rufusshrestha/izone/blob/main/src/web_install.rs): `src/web_install.rs`

### Configuration and security

- [Response models](https://github.com/rufusshrestha/izone/blob/main/src/models.rs): `src/models.rs`
- [Formatting helpers](https://github.com/rufusshrestha/izone/blob/main/src/helpers.rs): `src/helpers.rs`
- [IP and zones](https://github.com/rufusshrestha/izone/blob/main/src/constants.rs): `src/constants.rs`

### Other components

- **CLI user**
- **iZone controller**
- **Web user**

## Connections

- CLI user → CLI dispatch: runs commands (evidence: `README.md`)
- CLI dispatch → System controls: dispatches controls (evidence: `src/main.rs`)
- CLI dispatch → Zone controls: dispatches zone actions (evidence: `src/main.rs`)
- CLI dispatch → Schedules: dispatches schedules (evidence: `src/main.rs`)
- CLI dispatch → Web server and API: starts web mode (evidence: `src/main.rs`)
- System controls → Controller API: sends requests (evidence: `src/commands/system.rs`)
- Zone controls → Controller API: queries controller (evidence: `src/commands/zones.rs`)
- Schedules → Controller API: manages schedules (evidence: `src/commands/schedules.rs`)
- Controller API → iZone controller: sends HTTP requests (evidence: `src/api.rs`)
- Web server and API → Controller API: queries and commands (evidence: `src/web.rs`)
- Web user → Web server and API: uses web controls (evidence: `README.md`)
- Web server and API → Web interface: serves interface
- Web server and API → Password handling: checks sessions (evidence: `src/web.rs`)
- Service management → Password handling: resets credentials (evidence: `src/web_install.rs`)
- CLI dispatch → Service management: manages service (evidence: `src/main.rs`)
- CLI dispatch → IP and zones: loads settings (evidence: `src/main.rs`)
- Controller API → IP and zones: uses controller address (evidence: `src/api.rs`)
- System controls → Formatting helpers: formats output (evidence: `src/commands/system.rs`)
- Zone controls → Formatting helpers: formats output (evidence: `src/commands/zones.rs`)
- Schedules → Formatting helpers: formats output (evidence: `src/commands/schedules.rs`)
- System controls → Response models: uses response types (evidence: `src/commands/system.rs`)
- Zone controls → Response models: uses response types (evidence: `src/commands/zones.rs`)
- Schedules → Response models: uses schedule types (evidence: `src/commands/schedules.rs`)
