# exelban/stats architecture

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

- Interactive diagram: https://gitdiagram.com/exelban/stats
- Repository: https://github.com/exelban/stats

## Overview

Stats is a macOS menu-bar system monitor. Users enable monitoring modules, view live system metrics in menu-bar widgets and popups, and can optionally stream metrics through Remote. The repository separates the app shell and preferences from per-domain monitors, shared system/data services, and reusable visualizations. The README documents monitoring domains, remote-agent behavior, desktop widgets, and update checks; several module internals were not sampled, so uncertain runtime links are omitted or marked unverified.

Main entry points: [`Kit/Widgets`](https://github.com/exelban/stats/tree/master/Kit/Widgets) (Chart widgets), [`Kit/plugins/SystemKit.swift`](https://github.com/exelban/stats/blob/master/Kit/plugins/SystemKit.swift) (System access), [`Modules/CPU/main.swift`](https://github.com/exelban/stats/blob/master/Modules/CPU/main.swift) (CPU monitor), [`Modules/GPU/main.swift`](https://github.com/exelban/stats/blob/master/Modules/GPU/main.swift) (GPU monitor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["Stats app<br/>[AppDelegate.swift]"]
  node_preferences["Settings<br/>[Settings.swift]"]
end

subgraph group_monitors["System monitors"]
  node_cpu["CPU monitor<br/>[main.swift]"]
  node_gpu["GPU monitor<br/>[main.swift]"]
  node_memory["Memory monitor<br/>[main.swift]"]
  node_disk["Disk monitor<br/>[main.swift]"]
  node_network["Network monitor<br/>[main.swift]"]
  node_battery["Battery monitor<br/>[main.swift]"]
  node_bluetooth["Bluetooth monitor<br/>[main.swift]"]
  node_clock["Clock monitor<br/>[main.swift]"]
  node_sensors["Sensors monitor<br/>[main.swift]"]
  node_remote["Remote agent<br/>[main.swift]"]
end

subgraph group_shared["Shared services"]
  node_smc["SMC helper<br/>[main.swift]"]
  node_systemkit["System access<br/>[SystemKit.swift]"]
  node_store[("Preferences store<br/>[Store.swift]")]
  node_systemstats["Remote service<br/>[SystemStats.swift]"]
  node_updater["Update checks<br/>[Updater.swift]"]
end

subgraph group_surfaces["Display surfaces"]
  node_widgets["Chart widgets"]
  node_charts["Chart configuration<br/>[Charts.swift]"]
  node_desktopwidget["Desktop widget<br/>[UnitedWidget.swift]"]
end

node_user(("Mac user"))

node_user -.->|"uses"| node_app
node_user -.->|"configures"| node_preferences
node_preferences -.->|"persists settings"| node_store
node_cpu -.->|"reads system data"| node_systemkit
node_gpu -.->|"reads system data"| node_systemkit
node_memory -.->|"reads system data"| node_systemkit
node_disk -.->|"reads system data"| node_systemkit
node_network -.->|"reads system data"| node_systemkit
node_sensors -.->|"reads sensor data"| node_smc
node_remote -->|"streams metrics"| node_systemstats
node_systemstats -->|"reports remotely"| node_user
node_updater -->|"checks updates"| node_user
node_cpu -.->|"renders metrics"| node_widgets
node_gpu -.->|"renders metrics"| node_widgets
node_memory -.->|"renders metrics"| node_widgets
node_disk -.->|"renders metrics"| node_widgets
node_network -.->|"renders metrics"| node_widgets
node_battery -.->|"renders metrics"| node_widgets
node_charts -->|"configures charts"| node_widgets
node_desktopwidget -->|"displays metrics"| node_user

click node_app "https://github.com/exelban/stats/blob/master/Stats/AppDelegate.swift"
click node_preferences "https://github.com/exelban/stats/blob/master/Stats/Views/Settings.swift"
click node_cpu "https://github.com/exelban/stats/blob/master/Modules/CPU/main.swift"
click node_gpu "https://github.com/exelban/stats/blob/master/Modules/GPU/main.swift"
click node_memory "https://github.com/exelban/stats/blob/master/Modules/RAM/main.swift"
click node_disk "https://github.com/exelban/stats/blob/master/Modules/Disk/main.swift"
click node_network "https://github.com/exelban/stats/blob/master/Modules/Net/main.swift"
click node_battery "https://github.com/exelban/stats/blob/master/Modules/Battery/main.swift"
click node_bluetooth "https://github.com/exelban/stats/blob/master/Modules/Bluetooth/main.swift"
click node_clock "https://github.com/exelban/stats/blob/master/Modules/Clock/main.swift"
click node_sensors "https://github.com/exelban/stats/blob/master/Modules/Sensors/main.swift"
click node_remote "https://github.com/exelban/stats/blob/master/Modules/Remote/main.swift"
click node_smc "https://github.com/exelban/stats/blob/master/SMC/main.swift"
click node_systemkit "https://github.com/exelban/stats/blob/master/Kit/plugins/SystemKit.swift"
click node_store "https://github.com/exelban/stats/blob/master/Kit/plugins/Store.swift"
click node_systemstats "https://github.com/exelban/stats/blob/master/Kit/plugins/SystemStats.swift"
click node_updater "https://github.com/exelban/stats/blob/master/Kit/plugins/Updater.swift"
click node_widgets "https://github.com/exelban/stats/tree/master/Kit/Widgets"
click node_charts "https://github.com/exelban/stats/blob/master/Kit/plugins/Charts.swift"
click node_desktopwidget "https://github.com/exelban/stats/blob/master/Widgets/UnitedWidget.swift"

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_preferences,node_user toneBlue
class node_cpu,node_gpu,node_memory,node_disk,node_network,node_battery,node_bluetooth,node_clock,node_sensors,node_remote toneAmber
class node_smc,node_systemkit,node_store,node_systemstats,node_updater toneMint
class node_widgets,node_charts,node_desktopwidget toneRose
```

## Components

### App experience

- [Stats app](https://github.com/exelban/stats/blob/master/Stats/AppDelegate.swift): `Stats/AppDelegate.swift`
- [Settings](https://github.com/exelban/stats/blob/master/Stats/Views/Settings.swift): `Stats/Views/Settings.swift`

### System monitors

- [CPU monitor](https://github.com/exelban/stats/blob/master/Modules/CPU/main.swift): `Modules/CPU/main.swift`
- [GPU monitor](https://github.com/exelban/stats/blob/master/Modules/GPU/main.swift): `Modules/GPU/main.swift`
- [Memory monitor](https://github.com/exelban/stats/blob/master/Modules/RAM/main.swift): `Modules/RAM/main.swift`
- [Disk monitor](https://github.com/exelban/stats/blob/master/Modules/Disk/main.swift): `Modules/Disk/main.swift`
- [Network monitor](https://github.com/exelban/stats/blob/master/Modules/Net/main.swift): `Modules/Net/main.swift`
- [Battery monitor](https://github.com/exelban/stats/blob/master/Modules/Battery/main.swift): `Modules/Battery/main.swift`
- [Bluetooth monitor](https://github.com/exelban/stats/blob/master/Modules/Bluetooth/main.swift): `Modules/Bluetooth/main.swift`
- [Clock monitor](https://github.com/exelban/stats/blob/master/Modules/Clock/main.swift): `Modules/Clock/main.swift`
- [Sensors monitor](https://github.com/exelban/stats/blob/master/Modules/Sensors/main.swift): `Modules/Sensors/main.swift`
- [Remote agent](https://github.com/exelban/stats/blob/master/Modules/Remote/main.swift): `Modules/Remote/main.swift`

### Shared services

- [SMC helper](https://github.com/exelban/stats/blob/master/SMC/main.swift): `SMC/main.swift`
- [System access](https://github.com/exelban/stats/blob/master/Kit/plugins/SystemKit.swift): `Kit/plugins/SystemKit.swift`
- [Preferences store](https://github.com/exelban/stats/blob/master/Kit/plugins/Store.swift): `Kit/plugins/Store.swift`
- [Remote service](https://github.com/exelban/stats/blob/master/Kit/plugins/SystemStats.swift): `Kit/plugins/SystemStats.swift`
- [Update checks](https://github.com/exelban/stats/blob/master/Kit/plugins/Updater.swift): `Kit/plugins/Updater.swift`

### Display surfaces

- [Chart widgets](https://github.com/exelban/stats/tree/master/Kit/Widgets): `Kit/Widgets`
- [Chart configuration](https://github.com/exelban/stats/blob/master/Kit/plugins/Charts.swift): `Kit/plugins/Charts.swift`
- [Desktop widget](https://github.com/exelban/stats/blob/master/Widgets/UnitedWidget.swift): `Widgets/UnitedWidget.swift`

### Other components

- **Mac user**

## Connections

- Mac user → Stats app: uses
- Mac user → Settings: configures
- Settings → Preferences store: persists settings (evidence: `Stats/Views/Settings.swift`)
- CPU monitor → System access: reads system data (evidence: `Modules/CPU/main.swift`)
- GPU monitor → System access: reads system data
- Memory monitor → System access: reads system data
- Disk monitor → System access: reads system data
- Network monitor → System access: reads system data
- Sensors monitor → SMC helper: reads sensor data
- Remote agent → Remote service: streams metrics (evidence: `Modules/Remote/main.swift`)
- Remote service → Mac user: reports remotely
- Update checks → Mac user: checks updates
- CPU monitor → Chart widgets: renders metrics (evidence: `Modules/CPU/main.swift`)
- GPU monitor → Chart widgets: renders metrics (evidence: `Modules/GPU/main.swift`)
- Memory monitor → Chart widgets: renders metrics (evidence: `Modules/RAM/main.swift`)
- Disk monitor → Chart widgets: renders metrics (evidence: `Modules/Disk/main.swift`)
- Network monitor → Chart widgets: renders metrics (evidence: `Modules/Net/main.swift`)
- Battery monitor → Chart widgets: renders metrics (evidence: `Modules/Battery/main.swift`)
- Chart configuration → Chart widgets: configures charts (evidence: `Kit/plugins/Charts.swift`)
- Desktop widget → Mac user: displays metrics
