# patricks-js/vektor architecture

> Architecture diagram of the GitHub repository patricks-js/vektor, 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/patricks-js/vektor
- Repository: https://github.com/patricks-js/vektor

## Overview

Vektor is a native Linux monitoring and control plane. Users sign in to its web dashboard, inspect live and historical host telemetry, perform host or Incus operations, and review diagnostics and alerts. The daemon exposes authenticated HTTP/SSE services and persists history in SQLite; privileged actions use a separate Unix-socket helper. The README documents major capabilities, but many implementation excerpts are absent, so several subsystem connections are shown as unverified rather than asserted as source-confirmed calls.

Main entry points: [`internal/httpapi/server.go`](https://github.com/patricks-js/vektor/blob/main/internal/httpapi/server.go) (HTTP and SSE API), [`web/src/app/App.tsx`](https://github.com/patricks-js/vektor/blob/main/web/src/app/App.tsx) (Dashboard app), [`internal/incus/client.go`](https://github.com/patricks-js/vektor/blob/main/internal/incus/client.go) (Incus API client), [`web/src/lib/api/client.ts`](https://github.com/patricks-js/vektor/blob/main/web/src/lib/api/client.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Web dashboard"]
  node_webapp["Dashboard app<br/>[App.tsx]"]
  node_shell["Navigation shell<br/>[Shell.tsx]"]
  node_preferences["UI preferences<br/>[preferences.ts]"]
  node_overview["Overview<br/>[Overview.tsx]"]
  node_hostui["Host views<br/>[HostPage.tsx]"]
  node_instanceui["Instance views<br/>[InstanceDetail.tsx]"]
  node_webclient["API client<br/>[client.ts]"]
end

subgraph group_daemon["Daemon services"]
  node_daemonmain["Daemon runtime<br/>[main.go]"]
  node_httpapi["HTTP and SSE API<br/>[server.go]"]
  node_auth["Sessions and auth<br/>[store.go]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.go]"]
end

subgraph group_telemetry["Telemetry and state"]
  node_metriccollect["Linux collectors<br/>[discovery.go]"]
  node_scheduler["Collection scheduler<br/>[scheduler.go]"]
  node_historyquery["History queries<br/>[query.go]"]
  node_database[("SQLite database<br/>[database.go]")]
  node_alerts["Alert evaluation<br/>[evaluator.go]"]
end

subgraph group_operations["Host operations"]
  node_hostmgmt["Process and service info<br/>[processes.go]"]
  node_audit[("Action audit log<br/>[store.go]")]
  node_ctlserver["Privileged action helper<br/>[server.go]"]
  node_ctlclient["Privileged client<br/>[protocol.go]"]
end

subgraph group_virtualization["Incus virtualization"]
  node_incusapi["Incus API client<br/>[client.go]"]
  node_incusroutes["Incus HTTP handlers<br/>[incus.go]"]
  node_incusui["Instance management UI<br/>[InstancesPage.tsx]"]
end

node_user(("Operator"))
node_incusservice["Incus service"]
node_webhook["Alert webhook"]

node_user -->|"uses"| node_webapp
node_webapp -->|"renders"| node_shell
node_webapp -->|"stores settings"| node_preferences
node_webapp -->|"routes to"| node_overview
node_webapp -->|"routes to"| node_hostui
node_webapp -->|"routes to"| node_instanceui
node_webapp -.->|"provides API"| node_webclient
node_webclient -.->|"requests data"| node_httpapi
node_daemonmain -.->|"serves API"| node_httpapi
node_httpapi -.->|"authenticates"| node_auth
node_httpapi -->|"queries"| node_historyquery
node_metriccollect -.->|"collects through"| node_scheduler
node_scheduler -.->|"persists history"| node_database
node_historyquery -->|"reads history"| node_database
node_httpapi -.->|"serves diagnostics"| node_diagnostics
node_alerts -.->|"sends alerts"| node_webhook
node_httpapi -.->|"exposes host info"| node_hostmgmt
node_httpapi -.->|"records actions"| node_audit
node_httpapi -.->|"dispatches privileged actions"| node_ctlclient
node_ctlclient -.->|"sends socket requests"| node_ctlserver
node_ctlserver -->|"executes Incus actions"| node_incusapi
node_incusroutes -.->|"uses client"| node_incusapi
node_incusapi -->|"calls"| node_incusservice
node_incusui -.->|"manages instances"| node_incusroutes

click node_webapp "https://github.com/patricks-js/vektor/blob/main/web/src/app/App.tsx"
click node_shell "https://github.com/patricks-js/vektor/blob/main/web/src/app/Shell.tsx"
click node_preferences "https://github.com/patricks-js/vektor/blob/main/web/src/app/preferences.ts"
click node_overview "https://github.com/patricks-js/vektor/blob/main/web/src/features/overview/Overview.tsx"
click node_hostui "https://github.com/patricks-js/vektor/blob/main/web/src/features/host/HostPage.tsx"
click node_instanceui "https://github.com/patricks-js/vektor/blob/main/web/src/features/instances/InstanceDetail.tsx"
click node_webclient "https://github.com/patricks-js/vektor/blob/main/web/src/lib/api/client.ts"
click node_daemonmain "https://github.com/patricks-js/vektor/blob/main/cmd/vektord/main.go"
click node_httpapi "https://github.com/patricks-js/vektor/blob/main/internal/httpapi/server.go"
click node_auth "https://github.com/patricks-js/vektor/blob/main/internal/auth/store.go"
click node_diagnostics "https://github.com/patricks-js/vektor/blob/main/internal/diagnostics/diagnostics.go"
click node_metriccollect "https://github.com/patricks-js/vektor/blob/main/internal/metrics/collector/discovery.go"
click node_scheduler "https://github.com/patricks-js/vektor/blob/main/internal/metrics/scheduler/scheduler.go"
click node_historyquery "https://github.com/patricks-js/vektor/blob/main/internal/history/query.go"
click node_database "https://github.com/patricks-js/vektor/blob/main/internal/database/database.go"
click node_alerts "https://github.com/patricks-js/vektor/blob/main/internal/alerts/evaluator.go"
click node_hostmgmt "https://github.com/patricks-js/vektor/blob/main/internal/hostmgmt/processes.go"
click node_audit "https://github.com/patricks-js/vektor/blob/main/internal/audit/store.go"
click node_ctlserver "https://github.com/patricks-js/vektor/blob/main/internal/ctl/server.go"
click node_ctlclient "https://github.com/patricks-js/vektor/blob/main/internal/ctl/protocol.go"
click node_incusapi "https://github.com/patricks-js/vektor/blob/main/internal/incus/client.go"
click node_incusroutes "https://github.com/patricks-js/vektor/blob/main/internal/httpapi/incus.go"
click node_incusui "https://github.com/patricks-js/vektor/blob/main/web/src/features/instances/InstancesPage.tsx"

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_webapp,node_shell,node_preferences,node_overview,node_hostui,node_instanceui,node_webclient toneBlue
class node_daemonmain,node_httpapi,node_auth,node_diagnostics toneAmber
class node_metriccollect,node_scheduler,node_historyquery,node_database,node_alerts,node_webhook toneMint
class node_hostmgmt,node_audit,node_ctlserver,node_ctlclient toneRose
class node_incusapi,node_incusroutes,node_incusui,node_user,node_incusservice toneIndigo
```

## Components

### Web dashboard

- [Dashboard app](https://github.com/patricks-js/vektor/blob/main/web/src/app/App.tsx): `web/src/app/App.tsx`
- [Navigation shell](https://github.com/patricks-js/vektor/blob/main/web/src/app/Shell.tsx): `web/src/app/Shell.tsx`
- [UI preferences](https://github.com/patricks-js/vektor/blob/main/web/src/app/preferences.ts): `web/src/app/preferences.ts`
- [Overview](https://github.com/patricks-js/vektor/blob/main/web/src/features/overview/Overview.tsx): `web/src/features/overview/Overview.tsx`
- [Host views](https://github.com/patricks-js/vektor/blob/main/web/src/features/host/HostPage.tsx): `web/src/features/host/HostPage.tsx`
- [Instance views](https://github.com/patricks-js/vektor/blob/main/web/src/features/instances/InstanceDetail.tsx): `web/src/features/instances/InstanceDetail.tsx`
- [API client](https://github.com/patricks-js/vektor/blob/main/web/src/lib/api/client.ts): `web/src/lib/api/client.ts`

### Daemon services

- [Daemon runtime](https://github.com/patricks-js/vektor/blob/main/cmd/vektord/main.go): `cmd/vektord/main.go`
- [HTTP and SSE API](https://github.com/patricks-js/vektor/blob/main/internal/httpapi/server.go): `internal/httpapi/server.go`
- [Sessions and auth](https://github.com/patricks-js/vektor/blob/main/internal/auth/store.go): `internal/auth/store.go`
- [Diagnostics](https://github.com/patricks-js/vektor/blob/main/internal/diagnostics/diagnostics.go): `internal/diagnostics/diagnostics.go`

### Telemetry and state

- [Linux collectors](https://github.com/patricks-js/vektor/blob/main/internal/metrics/collector/discovery.go): `internal/metrics/collector/discovery.go`
- [Collection scheduler](https://github.com/patricks-js/vektor/blob/main/internal/metrics/scheduler/scheduler.go): `internal/metrics/scheduler/scheduler.go`
- [History queries](https://github.com/patricks-js/vektor/blob/main/internal/history/query.go): `internal/history/query.go`
- [SQLite database](https://github.com/patricks-js/vektor/blob/main/internal/database/database.go): `internal/database/database.go`
- [Alert evaluation](https://github.com/patricks-js/vektor/blob/main/internal/alerts/evaluator.go): `internal/alerts/evaluator.go`

### Host operations

- [Process and service info](https://github.com/patricks-js/vektor/blob/main/internal/hostmgmt/processes.go): `internal/hostmgmt/processes.go`
- [Action audit log](https://github.com/patricks-js/vektor/blob/main/internal/audit/store.go): `internal/audit/store.go`
- [Privileged action helper](https://github.com/patricks-js/vektor/blob/main/internal/ctl/server.go): `internal/ctl/server.go`
- [Privileged client](https://github.com/patricks-js/vektor/blob/main/internal/ctl/protocol.go): `internal/ctl/protocol.go`

### Incus virtualization

- [Incus API client](https://github.com/patricks-js/vektor/blob/main/internal/incus/client.go): `internal/incus/client.go`
- [Incus HTTP handlers](https://github.com/patricks-js/vektor/blob/main/internal/httpapi/incus.go): `internal/httpapi/incus.go`
- [Instance management UI](https://github.com/patricks-js/vektor/blob/main/web/src/features/instances/InstancesPage.tsx): `web/src/features/instances/InstancesPage.tsx`

### Other components

- **Operator**
- **Incus service**
- **Alert webhook**

## Connections

- Operator → Dashboard app: uses (evidence: `README.md`)
- Dashboard app → Navigation shell: renders (evidence: `web/src/app/App.tsx`)
- Dashboard app → UI preferences: stores settings (evidence: `web/src/app/App.tsx`)
- Dashboard app → Overview: routes to (evidence: `web/src/app/App.tsx`)
- Dashboard app → Host views: routes to (evidence: `web/src/app/App.tsx`)
- Dashboard app → Instance views: routes to (evidence: `web/src/app/App.tsx`)
- Dashboard app → API client: provides API
- API client → HTTP and SSE API: requests data
- Daemon runtime → HTTP and SSE API: serves API
- HTTP and SSE API → Sessions and auth: authenticates
- HTTP and SSE API → History queries: queries (evidence: `internal/httpapi/server.go`)
- Linux collectors → Collection scheduler: collects through
- Collection scheduler → SQLite database: persists history (evidence: `README.md`)
- History queries → SQLite database: reads history (evidence: `internal/history/query.go`)
- HTTP and SSE API → Diagnostics: serves diagnostics (evidence: `README.md`)
- Alert evaluation → Alert webhook: sends alerts (evidence: `README.md`)
- HTTP and SSE API → Process and service info: exposes host info (evidence: `internal/httpapi/server.go`)
- HTTP and SSE API → Action audit log: records actions (evidence: `README.md`)
- HTTP and SSE API → Privileged client: dispatches privileged actions (evidence: `README.md`)
- Privileged client → Privileged action helper: sends socket requests (evidence: `README.md`)
- Privileged action helper → Incus API client: executes Incus actions (evidence: `internal/ctl/server.go`)
- Incus HTTP handlers → Incus API client: uses client
- Incus API client → Incus service: calls (evidence: `README.md`)
- Instance management UI → Incus HTTP handlers: manages instances (evidence: `README.md`)
