# daveyhert/dishylink architecture

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

- Interactive diagram: https://gitdiagram.com/daveyhert/dishylink
- Repository: https://github.com/daveyhert/dishylink

## Overview

#### Purpose and product boundaries
Dishylink is a local-first Starlink monitor/control suite delivered as three independent runtimes: Vite web development harness, Electron desktop app, and WXT browser extension. Each directly polls Starlink LAN APIs and maintains separate local history; optional authenticated Starlink cloud access adds account data and supported controls. Main UI starts at `src/main.tsx` and `src/App.tsx`.

#### Shared device protocol layer
The platform-neutral `core/` layer communicates with dish and router grpc-web endpoints, decodes reflected protobuf schemas, normalizes telemetry, and issues safe configuration updates. It is the boundary between product runtimes and Starlink devices on the LAN.
- `core/dishClient.ts`
- `core/grpcWeb.ts`
- `core/routerEndpoint.ts`
- `schema/dish.protoset`

#### Telemetry, history, and alert domain
Telemetry unrolls the dish’s short ring buffer using its absolute sample counter; usage, energy, throughput, router-client history, and outages are derived into durable/displayable windows. The alert engine evaluates definitions and produces notifications independently of rendering.
- `core/telemetry.ts`
- `core/throughputTracker.ts`
- `core/alertEngine.ts`
- `core/clientHistory.ts`

#### Persistent desktop collector
The Node-based historian continuously polls and appends local records, preserving sampling gaps rather than interpolating them. Domain-specific stores support alerts, client totals/windows, energy, obstruction snapshots, thermal events, and router events. Electron runs this collector even when the app window is closed.
- `collector/historian.mts`
- `collector/jsonLinesFile.mts`
- `collector/clientStore.mts`
- `electron/collector.ts`

#### React dashboard and feature modules
The shared TypeScript/React frontend composes hook-driven LAN/cloud/history state into dashboard, network, settings, obstruction, satellite, usage, and alert interfaces. Hooks are the UI-to-domain integration boundary; components should not own device transport or durable history semantics.
- `src/App.tsx`
- `src/hooks/useDishTelemetry.ts`
- `src/hooks/useRouterNetwork.ts`
- `src/components/dashboard/DashboardView.tsx`
- `src/components/settings/SettingsModal.tsx`

#### Electron desktop host
Electron provides desktop lifecycle, IPC/preload isolation, tray/menu-bar or Windows throughput surfaces, preferences, notifications, auto-updates, and cloud/collector bridging. Renderer code reaches privileged services through IPC rather than Node APIs directly.
- `electron/main.ts`
- `electron/ipc.ts`
- `electron/preload.ts`
- `electron/menuBarThroughput.ts`
- `electron/updater.ts`

#### Browser extension host
The WXT extension has a background service worker plus a dashboard entrypoint. Its browser-specific transport handles LAN requests, IndexedDB-oriented history/collection, alarms-driven sampling, toolbar alert state, and cloud requests within extension permissions and host limitations.
- `extension/entrypoints/background.ts`
- `extension/entrypoints/dashboard/main.tsx`
- `extension/lib/apiTransport.ts`
- `extension/lib/collector.ts`
- `extension/lib/history.ts`

#### External infrastructure and delivery
Starlink dish/router grpc-web endpoints are the primary external device interfaces; the optional Starlink authenticated cloud API is isolated in cloud handlers/transports. Development uses a proxy to work around device CORS/referer behavior. Electron is packaged with electron-builder; extension builds use WXT; the separate Astro site is a marketing deployment, not part of app runtime.
- `cloud/starlinkCloudHandler.ts`
- `src/lib/starlinkCloud.ts`
- `dev/routerProxy.ts`
- `electron-builder.yml`
- `landing/src/pages/index.astro`

Main entry points: [`src/hooks/useDishTelemetry.ts`](https://github.com/daveyhert/dishylink/blob/master/src/hooks/useDishTelemetry.ts) (Domain hooks), [`collector/historian.mts`](https://github.com/daveyhert/dishylink/blob/master/collector/historian.mts) (Historian), [`core/dishClient.ts`](https://github.com/daveyhert/dishylink/blob/master/core/dishClient.ts) (Device protocol client), [`core/telemetry.ts`](https://github.com/daveyhert/dishylink/blob/master/core/telemetry.ts) (Telemetry derivation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared domain"]
  node_device_client["Device protocol client<br/>LAN protocol<br/>[dishClient.ts]"]
  node_grpc_transport["gRPC-web transport<br/>[grpcWeb.ts]"]
  node_protobuf_schema["Reflected protobuf schema<br/>protocol schema<br/>[dish.protoset]"]
  node_telemetry["Telemetry derivation<br/>domain pipeline<br/>[telemetry.ts]"]
  node_throughput["Throughput tracker<br/>domain metric"]
  node_alerts["Alert engine<br/>domain rules<br/>[alertEngine.ts]"]
end

subgraph group_web["React UI"]
  node_app["App shell<br/>React entry<br/>[App.tsx]"]
  node_ui_hooks["Domain hooks<br/>UI integration"]
  node_dashboard["Dashboard view<br/>React feature<br/>[DashboardView.tsx]"]
  node_settings["Settings UI<br/>React feature<br/>[SettingsModal.tsx]"]
end

subgraph group_desktop["Electron desktop"]
  node_historian["Historian<br/>Node collector<br/>[historian.mts]"]
  node_history_store[("Local history stores<br/>durable storage<br/>[jsonLinesFile.mts]")]
  node_electron_main["Electron main process<br/>desktop host<br/>[main.ts]"]
  node_electron_ipc{{"IPC and preload bridge<br/>privilege boundary<br/>[ipc.ts]"}}
  node_updater["Desktop updater<br/>update service<br/>[updater.ts]"]
end

subgraph group_extension["Browser extension"]
  node_extension_background["Extension background<br/>WXT service worker<br/>[background.ts]"]
  node_extension_dashboard["Extension dashboard<br/>WXT UI entry<br/>[main.tsx]"]
  node_extension_collector[("Extension collector and history<br/>browser persistence<br/>[collector.ts]")]
end

subgraph group_external["External services"]
  node_lan_devices{{"Starlink LAN APIs<br/>external device"}}
  node_cloud_api{{"Starlink cloud API<br/>external cloud"}}
  node_cloud_handler["Cloud handler<br/>cloud boundary"]
end

subgraph group_delivery["Delivery"]
  node_dev_proxy["Development proxy<br/>Vite support<br/>[routerProxy.ts]"]
  node_electron_package["Electron package<br/>desktop delivery"]
  node_extension_build["WXT extension build<br/>extension delivery"]
  node_landing_site["Astro marketing site<br/>separate deployment<br/>[index.astro]"]
end

node_app -->|"uses"| node_ui_hooks
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_settings
node_ui_hooks -->|"reads and controls"| node_device_client
node_ui_hooks -->|"consumes"| node_telemetry
node_ui_hooks -->|"consumes"| node_alerts
node_device_client -->|"uses"| node_grpc_transport
node_device_client -->|"decodes with"| node_protobuf_schema
node_grpc_transport -->|"grpc-web"| node_lan_devices
node_telemetry -->|"derives"| node_throughput
node_telemetry -->|"supplies metrics"| node_alerts
node_historian -->|"polls through"| node_device_client
node_historian -->|"derives"| node_telemetry
node_historian -->|"appends"| node_history_store
node_historian -->|"evaluates"| node_alerts
node_electron_main -->|"runs when window closed"| node_historian
node_electron_main -->|"hosts"| node_electron_ipc
node_electron_ipc -->|"privileged bridge"| node_app
node_electron_main -->|"manages"| node_updater
node_extension_dashboard -->|"messaging"| node_extension_background
node_extension_background -->|"schedules"| node_extension_collector
node_extension_collector -->|"uses shared protocol"| node_device_client
node_extension_collector -->|"derives"| node_telemetry
node_extension_collector -->|"evaluates"| node_alerts
node_ui_hooks -.->|"optional cloud state"| node_cloud_handler
node_cloud_handler -->|"authenticated requests"| node_cloud_api
node_dev_proxy -.->|"development forwarding"| node_lan_devices
node_electron_package -->|"packages"| node_electron_main
node_extension_build -->|"builds"| node_extension_background

click node_app "https://github.com/daveyhert/dishylink/blob/master/src/App.tsx"
click node_ui_hooks "https://github.com/daveyhert/dishylink/blob/master/src/hooks/useDishTelemetry.ts"
click node_dashboard "https://github.com/daveyhert/dishylink/blob/master/src/components/dashboard/DashboardView.tsx"
click node_settings "https://github.com/daveyhert/dishylink/blob/master/src/components/settings/SettingsModal.tsx"
click node_device_client "https://github.com/daveyhert/dishylink/blob/master/core/dishClient.ts"
click node_grpc_transport "https://github.com/daveyhert/dishylink/blob/master/core/grpcWeb.ts"
click node_protobuf_schema "https://github.com/daveyhert/dishylink/blob/master/schema/dish.protoset"
click node_telemetry "https://github.com/daveyhert/dishylink/blob/master/core/telemetry.ts"
click node_throughput "https://github.com/daveyhert/dishylink/blob/master/core/throughputTracker.ts"
click node_alerts "https://github.com/daveyhert/dishylink/blob/master/core/alertEngine.ts"
click node_historian "https://github.com/daveyhert/dishylink/blob/master/collector/historian.mts"
click node_history_store "https://github.com/daveyhert/dishylink/blob/master/collector/jsonLinesFile.mts"
click node_electron_main "https://github.com/daveyhert/dishylink/blob/master/electron/main.ts"
click node_electron_ipc "https://github.com/daveyhert/dishylink/blob/master/electron/ipc.ts"
click node_updater "https://github.com/daveyhert/dishylink/blob/master/electron/updater.ts"
click node_extension_background "https://github.com/daveyhert/dishylink/blob/master/extension/entrypoints/background.ts"
click node_extension_dashboard "https://github.com/daveyhert/dishylink/blob/master/extension/entrypoints/dashboard/main.tsx"
click node_extension_collector "https://github.com/daveyhert/dishylink/blob/master/extension/lib/collector.ts"
click node_cloud_handler "https://github.com/daveyhert/dishylink/blob/master/cloud/starlinkCloudHandler.ts"
click node_dev_proxy "https://github.com/daveyhert/dishylink/blob/master/dev/routerProxy.ts"
click node_electron_package "https://github.com/daveyhert/dishylink/blob/master/electron-builder.yml"
click node_landing_site "https://github.com/daveyhert/dishylink/blob/master/landing/src/pages/index.astro"

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_device_client,node_grpc_transport,node_protobuf_schema,node_telemetry,node_throughput,node_alerts toneBlue
class node_app,node_ui_hooks,node_dashboard,node_settings toneAmber
class node_historian,node_history_store,node_electron_main,node_electron_ipc,node_updater toneMint
class node_extension_background,node_extension_dashboard,node_extension_collector toneRose
class node_lan_devices,node_cloud_api,node_cloud_handler toneIndigo
class node_dev_proxy,node_electron_package,node_extension_build,node_landing_site toneTeal
```

## Components

### Shared domain

Platform-neutral device, telemetry, and alert logic.

- [Device protocol client](https://github.com/daveyhert/dishylink/blob/master/core/dishClient.ts): LAN protocol · Calls dish and router grpc-web APIs and applies safe updates. · `core/dishClient.ts`
- [gRPC-web transport](https://github.com/daveyhert/dishylink/blob/master/core/grpcWeb.ts): transport · `core/grpcWeb.ts`
- [Reflected protobuf schema](https://github.com/daveyhert/dishylink/blob/master/schema/dish.protoset): protocol schema · `schema/dish.protoset`
- [Telemetry derivation](https://github.com/daveyhert/dishylink/blob/master/core/telemetry.ts): domain pipeline · Unrolls ring-buffer samples into durable display windows. · `core/telemetry.ts`
- [Throughput tracker](https://github.com/daveyhert/dishylink/blob/master/core/throughputTracker.ts): domain metric · `core/throughputTracker.ts`
- [Alert engine](https://github.com/daveyhert/dishylink/blob/master/core/alertEngine.ts): domain rules · Evaluates definitions independently of rendering. · `core/alertEngine.ts`

### React UI

Shared dashboard frontend and development host.

- [App shell](https://github.com/daveyhert/dishylink/blob/master/src/App.tsx): React entry · `src/App.tsx`
- [Domain hooks](https://github.com/daveyhert/dishylink/blob/master/src/hooks/useDishTelemetry.ts): UI integration · Compose LAN, cloud, and history state for views. · `src/hooks/useDishTelemetry.ts`
- [Dashboard view](https://github.com/daveyhert/dishylink/blob/master/src/components/dashboard/DashboardView.tsx): React feature · `src/components/dashboard/DashboardView.tsx`
- [Settings UI](https://github.com/daveyhert/dishylink/blob/master/src/components/settings/SettingsModal.tsx): React feature · `src/components/settings/SettingsModal.tsx`

### Electron desktop

Privileged desktop host and persistent collection.

- [Historian](https://github.com/daveyhert/dishylink/blob/master/collector/historian.mts): Node collector · Continuously polls and preserves sampling gaps. · `collector/historian.mts`
- [Local history stores](https://github.com/daveyhert/dishylink/blob/master/collector/jsonLinesFile.mts): durable storage · JSON-lines records and domain-specific client history. · `collector/jsonLinesFile.mts`
- [Electron main process](https://github.com/daveyhert/dishylink/blob/master/electron/main.ts): desktop host · Owns lifecycle, tray surfaces, preferences, and notifications. · `electron/main.ts`
- [IPC and preload bridge](https://github.com/daveyhert/dishylink/blob/master/electron/ipc.ts): privilege boundary · Renderer reaches privileged services without direct Node APIs. · `electron/ipc.ts`
- [Desktop updater](https://github.com/daveyhert/dishylink/blob/master/electron/updater.ts): update service · `electron/updater.ts`

### Browser extension

WXT runtime with browser-specific collection.

- [Extension background](https://github.com/daveyhert/dishylink/blob/master/extension/entrypoints/background.ts): WXT service worker · Runs alarms, toolbar alert state, and privileged extension flows. · `extension/entrypoints/background.ts`
- [Extension dashboard](https://github.com/daveyhert/dishylink/blob/master/extension/entrypoints/dashboard/main.tsx): WXT UI entry · `extension/entrypoints/dashboard/main.tsx`
- [Extension collector and history](https://github.com/daveyhert/dishylink/blob/master/extension/lib/collector.ts): browser persistence · Collects under extension constraints using IndexedDB-oriented history. · `extension/lib/collector.ts`

### External services

Device LAN and optional cloud boundaries.

- **Starlink LAN APIs**: external device · Dish and router grpc-web endpoints.
- **Starlink cloud API**: external cloud · Optional authenticated account data and supported controls.
- [Cloud handler](https://github.com/daveyhert/dishylink/blob/master/cloud/starlinkCloudHandler.ts): cloud boundary · `cloud/starlinkCloudHandler.ts`

### Delivery

Development proxy and independent build targets.

- [Development proxy](https://github.com/daveyhert/dishylink/blob/master/dev/routerProxy.ts): Vite support · Works around device CORS and referer behavior. · `dev/routerProxy.ts`
- [Electron package](https://github.com/daveyhert/dishylink/blob/master/electron-builder.yml): desktop delivery · `electron-builder.yml`
- **WXT extension build**: extension delivery
- [Astro marketing site](https://github.com/daveyhert/dishylink/blob/master/landing/src/pages/index.astro): separate deployment · Not part of the application runtime. · `landing/src/pages/index.astro`

## Connections

- App shell → Domain hooks: uses
- App shell → Dashboard view: renders
- App shell → Settings UI: renders
- Domain hooks → Device protocol client: reads and controls
- Domain hooks → Telemetry derivation: consumes
- Domain hooks → Alert engine: consumes
- Device protocol client → gRPC-web transport: uses
- Device protocol client → Reflected protobuf schema: decodes with
- gRPC-web transport → Starlink LAN APIs: grpc-web
- Telemetry derivation → Throughput tracker: derives
- Telemetry derivation → Alert engine: supplies metrics
- Historian → Device protocol client: polls through
- Historian → Telemetry derivation: derives
- Historian → Local history stores: appends
- Historian → Alert engine: evaluates
- Electron main process → Historian: runs when window closed
- Electron main process → IPC and preload bridge: hosts
- IPC and preload bridge → App shell: privileged bridge
- Electron main process → Desktop updater: manages
- Extension dashboard → Extension background: messaging
- Extension background → Extension collector and history: schedules
- Extension collector and history → Device protocol client: uses shared protocol
- Extension collector and history → Telemetry derivation: derives
- Extension collector and history → Alert engine: evaluates
- Domain hooks → Cloud handler: optional cloud state
- Cloud handler → Starlink cloud API: authenticated requests
- Development proxy → Starlink LAN APIs: development forwarding
- Electron package → Electron main process: packages
- WXT extension build → Extension background: builds
