Skip to content

Building and running

The Rust version is pinned in rust-toolchain.toml (1.99.0, with the wasm32-unknown-unknown target); rustup installs it automatically. On Linux the desktop shell also needs the WebKitGTK development packages:

Terminal window
sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev

Two prebuilt tools, installed with cargo-binstall (so nothing is compiled):

Terminal window
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

The development laptop is slow, so run the narrowest command that verifies a change:

Terminal window
cargo fmt --all
cargo clippy -p beholder-server --all-targets -- -D warnings
cargo test -p beholder-server permissions
cargo check -p beholder-core -p beholder-protocol -p beholder-ui --target wasm32-unknown-unknown

Before a commit that touches several crates:

Terminal window
cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace

Terminal 1, the server (data in ./data-dev):

Terminal window
BEHOLDER_DATA_DIR=./data-dev cargo run -p beholder-server

Terminal 2, the desktop app (it starts trunk serve for the UI on port 1420):

Terminal window
cd apps/desktop/src-tauri
cargo tauri dev

Use http://127.0.0.1:8080 as the server address. To try two players, register a second account on another machine pointing at your LAN IP, or log out and in again.

Terminal window
cd apps/desktop/ui && trunk build --release # UI only; WASM in dist/
cd apps/desktop/src-tauri && cargo tauri build --bundles deb,rpm # Linux
cd apps/desktop/src-tauri && cargo tauri build --bundles nsis # Windows
docker build -f deploy/Dockerfile -t beholder-server . # server image

CI (.github/workflows/) runs fmt, clippy, tests and the wasm check on every push, reports the UI WASM and server binary sizes, publishes the server image to GHCR, and builds the installers on v* tags.

Downloading crates over a slow VPN is the usual bottleneck. Fetch once while the connection is good, then work offline:

Terminal window
export CARGO_NET_RETRY=10 CARGO_HTTP_TIMEOUT=180
cargo fetch
cargo build --offline

A crates.io mirror such as rsproxy.cn can be set in your user-level ~/.cargo/config.toml (never in the repository).

The docs are an Astro Starlight site in docs/site. They need Node ≥ 22.12:

Terminal window
cd docs/site
npm install
npm run dev # http://localhost:4321/docs/
npm run build # static site in docs/site/dist, with offline search