beszel-protocol 0.3.0

Shared wire types for Beszel realtime SSE payloads and the local beszel-relay NDJSON socket protocol
Documentation
  • Coverage
  • 56.67%
    51 out of 90 items documented0 out of 20 items with examples
  • Size
  • Source code size: 32.0 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 791.6 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • henriksvensson/beszel-desktop
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • henriksvensson

Beszel Desktop

CI License: MIT

Monitor remote servers, homelab nodes, and other machines live (~1 Hz) right from your Linux Wayland desktop bar — without keeping a browser tab open to a monitoring dashboard.

Beszel Desktop connects to your Beszel hub and streams real-time CPU, memory, and per-core utilization for any number of remote (or local) hosts into compact desktop widgets. Instead of giving every bar widget your Beszel credentials and opening duplicate connections, one lightweight per-user Rust daemon (beszel-relay) authenticates with your hub and fans out live updates over a user-only Unix socket to any widget or CLI tool.

Highlights

  • Remote multi-host monitoring in your bar: Keep an eye on build servers, VPSes, homelab nodes, or workstations side by side at ~1 Hz. Watches Beszel's systems/* collection live so hosts coming online or going offline update automatically.
  • Slim, jitter-free bar pills: Compact <host> + CPU/RAM icons with fixed-width zero-padded percentages (00%–99%) and smooth severity coloring (amber warning, red danger).
  • Real-time popout telemetry: Switch between remote hosts in one click to inspect hover-scrubbable CPU & memory sparklines (with outage gap breaks) and an animated per-core CPU heatmap.
  • Credentials never touch widgets: Passwords stay inside beszel-relay, encrypted at rest via systemd-creds (TPM2 + host key when available). Widgets read only from a 0600 Unix socket under $XDG_RUNTIME_DIR.
  • Laptop & server friendly: Automatically pauses upstream rt_metrics polling when no widgets are connected (e.g., locked/closed shell) and detects wake-from-sleep clock jumps for instant reconnects.

Supported Desktop Shells

Shell Minimum Version Features Setup Guide
DankMaterialShell (DMS) DMS >= 2.0 / Quickshell 0.3+ Direct Unix socket, one-click host discovery & variants, sparklines, per-core heatmap shells/dms/README.md
Noctalia Shell v5 Noctalia v5.5+ (plugin_api = 48) Singleton Luau service, per-instance bar pills, attached telemetry panel & heatmap shells/noctalia/README.md
Waybar Waybar 0.15+ Continuous JSON stream via beszel-ctl waybar with warning/danger/stale CSS classes shells/waybar/README.md

Quick Start

Prerequisites

  • A Beszel hub and agents running >= 0.13.0 (verified on 0.21.2).
  • Linux x86_64 or aarch64 (systemd >= 256 enables TPM2/host-key encrypted credentials via systemd-creds; older systemd such as Ubuntu 24.04's systemd 255 automatically falls back to a 0600 credential file).

1. Install and configure beszel-relay + beszel-ctl

One-command install & setup (downloads SHA-256-verified binaries from GitHub Releases and runs beszel-ctl init):

curl -fsSL https://raw.githubusercontent.com/henriksvensson/beszel-desktop/main/packaging/install.sh | sh

Prefer to install via a package manager or from source?

  • Homebrew (Linux): brew install henriksvensson/tap/beszel-desktop && beszel-ctl init
  • Nix: nix profile install github:henriksvensson/beszel-desktop && beszel-ctl init
  • Debian / Ubuntu (.deb) & Fedora / openSUSE (.rpm): Download from GitHub Releases, install with apt/dnf, then run beszel-ctl init
  • From source:
    git clone https://github.com/henriksvensson/beszel-desktop.git
    cd beszel-desktop
    cargo build --release --workspace
    install -Dm755 target/release/beszel-relay ~/.local/bin/beszel-relay
    install -Dm755 target/release/beszel-ctl ~/.local/bin/beszel-ctl
    ~/.local/bin/beszel-ctl init
    

beszel-ctl init prompts for your Beszel hub URL, email, and password (hidden), verifies login and lists discovered hosts, stores credentials securely (systemd-creds on systemd >= 256 or a 0600 file via LoadCredential= on older systemd), and enables beszel-relay.service.

Verify the live stream locally at any time:

beszel-ctl status
beszel-ctl watch

Update ~/.local/bin binaries later (downloads & SHA-256-verifies the latest GitHub Release and restarts beszel-relay.service):

beszel-ctl update

2. Add a desktop widget

Follow the setup guide for your shell:

See packaging/README.md and packaging/config.example.toml for manual setup, alternative credential methods (BESZEL_PASSWORD_FILE, password_file), and host filtering options.

Architecture

  • crates/beszel-relay (per-user daemon): Maintains one authenticated PocketBase SSE connection per configured hub, watches systems/* live, streams rt_metrics for all up systems (or a configured subset), pauses rt_metrics when zero local clients are connected, detects wake-from-sleep clock jumps, keeps a bounded rolling history per system, and re-registers subscriptions with the new PB_CONNECT client ID after reconnects.
  • crates/beszel-protocol (shared wire crate): Typed models for upstream Beszel SSE payloads and the local NDJSON socket protocol (kept free of async/runtime dependencies). Newly connected clients receive a snapshot with recent history followed by incremental sample, connection, and systems_changed frames.
  • crates/beszel-ctl (local socket CLI): Connects only to $XDG_RUNTIME_DIR/beszel-relay.sock (status, watch [--raw] [--reconnect], waybar).
  • shells/ (presentation adapters): Thin, credential-free widgets for DankMaterialShell, Noctalia Shell v5, and Waybar.

Design Invariants

  • Credentials stay in beszel-relay. Shell adapters and beszel-ctl talk only to the local 0600 Unix socket; never pass hub credentials to widgets.
  • Separate live and historical models: Keep the ~1 Hz live stream distinct from any future historical REST backfill because stored history has a different cadence.
  • Defensive upstream decoding: Beszel notes API payloads can change between minor releases and Go structs omit zero fields per tick; decode optional fields permissively and ignore unknown keys.

Repository Layout

  • crates/beszel-protocol/ — Upstream Beszel SSE and local NDJSON wire types.
  • crates/beszel-relay/ — Per-user daemon binary (beszel-relay).
  • crates/beszel-ctl/ — Thin socket client / CLI binary (beszel-ctl).
  • shells/dms/ — DankMaterialShell QML plugin.
  • shells/noctalia/ — Noctalia Shell v5 Luau plugin.
  • shells/waybar/ — Waybar custom module config and CSS.
  • packaging/ — Systemd user service unit, install guide, and example config.
  • docs/ — Verified upstream/local protocol documentation and sanitized test fixtures.

Protocol & Reference Documentation

Development & Tooling

Use plain cargo:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

Pre-commit Hook (CodeScene CodeHealth)

Enable the tracked git hook once per clone:

git config core.hooksPath .githooks

.githooks/pre-commit runs cs delta --git-hook --staged when cs is installed (requires CS_ACCESS_TOKEN in the environment or cs auth login).

Environment Files (evnx)

Manage .env / .env.example files with evnx (evnx add, evnx remove, evnx sync, evnx validate, evnx scan) rather than ad-hoc edits. See .env.example for supported environment overrides.

Security & Fixtures

  • Never commit real hub URLs, credentials, tokens, real system IDs, hostnames, SSIDs, or unsanitized payload dumps.
  • Put sanitized development captures in docs/fixtures/ with all identifying fields scrubbed before committing.

How This Project Is Built

Beszel Desktop is developed openly with AI assistance: the maintainer drives the architecture, UX decisions, security boundaries, and live desktop verification, while Gemini 4 Neon (running in T3 Code via Antigravity) has done the bulk of the implementation across the Rust backend, shell plugins, documentation, and tests. Every change is validated with cargo fmt, cargo clippy -D warnings, automated unit/integration tests, and CodeScene CodeHealth checks.

License

Licensed under the MIT License.