Skip to content

Development Environment Setup

This guide covers local development setup for Mesh Client (Meshtastic, MeshCore, and Reticulum), including cloning, prerequisites, and test harness tooling. For runtime errors, connection issues, and packaged-app problems, see troubleshooting.md.

Shared Requirements and Tooling

These requirements apply to all platforms.

1) Required software

  • Git
  • Node.js 22.15.0+ and pnpm 12+ (package.json engines; the repo pins packageManager to a specific pnpm release — use Corepack when available, or npm install -g corepack@latest / npm install -g pnpm@<pin> on Node 25+ where Corepack is not bundled). pnpm install fails on engine mismatch. After pulling a pnpm major bump, preinstall and pnpm run dev print an upgrade banner with the exact install command if your local pnpm is too old or the wrong major.
  • CI uses Node 22
  • Python 3.x + pip (needed for MkDocs documentation build and yamllint; docs/yamllint installs use --only-binary with hash-locked requirements)

Verify:

git --version
node --version
pnpm --version

First run (humans and AIs)

Use this short recipe on a fresh clone (agents: same order):

  1. node scripts/check-environment.mjs (works before pnpm is installed).
  2. After Node/pnpm exist, prefer pnpm run setup:dev — installs Semgrep, yamllint, and native build deps; ensures Rust/cargo + clippy; sets git config core.hooksPath .githooks; re-runs check:environment; then smokes with pnpm run typecheck when node_modules exists. actionlint comes from the github-actionlint devDependency installed by pnpm install. Or follow printed → hints / individual setup:* scripts.
  3. pnpm install (or pnpm install --frozen-lockfile on a clean clone).
  4. pnpm run setup:dev again (or at least pnpm run check:environment) — must exit 0.
  5. Optional UI smoke: pnpm run dev.
  6. Before commit/push: confirm git config core.hooksPath is .githooks; run pnpm run check:changed before push.

OS-specific install notes are below. Deeper tooling tables live in Helper scripts.

Environment check

Run the automated checklist after cloning (works before pnpm is installed):

node scripts/check-environment.mjs # before pnpm install
pnpm install
pnpm run setup:dev # preferred: install required tools, re-check, typecheck smoke
# or: pnpm run check:environment
pnpm run dev

Required checks (must pass): Git, Node.js, pnpm, node_modules, platform-native build tools (Xcode CLT on macOS, g++/make on Linux, MSVC cl on Windows), Semgrep, yamllint, Rust/cargo, and cargo clippy. Semgrep App login / SEMGREP_APP_TOKEN are not required (registry network access is needed for the public rule packs).

Optional checks (warnings only): Python/pip, cargo llvm-cov, actionlint (provided by pnpm install via github-actionlint), a Docker-compatible container engine (Podman preferred), act, Playwright, and Linux dialout group membership. For local CI you can use container mode (pnpm run act:ci — act + Podman/Docker) or host mode (pnpm run act:ci:native — no container engine). Fix optional items when you need docs builds, workflow linting, local CI parity, sidecar coverage reports, or USB serial on Linux.

Use the printed → hints and setup:* scripts (setup:dev, setup:semgrep, setup:yamllint, setup:build-deps, setup:dialout) to fix failures. See Helper scripts (auto-install where possible) below.

MkDocs (documentation) tooling

Docs are built with MkDocs Material.

  1. Create and activate a local virtual environment (recommended on macOS/Homebrew Python because of PEP 668 externally managed environments):
  2. macOS/Linux:
    • python3 -m venv .venv
    • source .venv/bin/activate
  3. Windows PowerShell:
    • py -3 -m venv .venv
    • .\.venv\Scripts\Activate.ps1
  4. Install the docs dependencies (hash-locked --only-binary, matching CI):
  5. pnpm run docs:install
  6. or (manual): python3 -m pip install --require-hashes --only-binary=:all: -r docs/requirements.txt
  7. Build locally:
  8. pnpm run docs:build
  9. Preview locally:
  10. pnpm run docs:serve

If pnpm run docs:install fails with externally-managed-environment, activate .venv and rerun.

2) Clone and install

git clone https://github.com/Colorado-Mesh/mesh-client
cd mesh-client
node scripts/check-environment.mjs # recommended on first clone
pnpm install
pnpm run setup:dev # required tools + check:environment + typecheck smoke

If you are updating from an older clone, use a clean install when troubleshooting native module issues:

rm -rf node_modules package-lock.json
pnpm install

3) Run the app

  • Dev mode (hot reload): pnpm run dev
  • Production-like local start: pnpm start

Reticulum sidecar (optional)

Reticulum/LXMF runs in a separate Rust binary (mesh-client-reticulum) spawned by the Electron main process. The GPL-3.0-or-later TypeScript layers talk to it over localhost HTTP/WS only. You only need this when working on the Reticulum protocol tab.

Installing Rust

Recommended: rustup — matches CI and pnpm run update:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env" # or open a new terminal
rustc --version
cargo --version

macOS Homebrew alternative: brew install rust works for local cargo build, but CI uses rustup. Do not install both rustup and Homebrew rust on the same machine — they can fight over rustc/cargo on your PATH. Pick one:

Approach Install Update
rustup (preferred) rustup.rs rustup update (also run by pnpm run update)
Homebrew brew install rust brew upgrade rust

If you use Homebrew only, pnpm run update will try brew upgrade rust when rustup is absent. For cross-target builds (WoA, Linux glibc) and toolchain pins, prefer rustup.

Linux and Windows: use rustup; on Windows you may also need Visual Studio Build Tools with the C++ workload (same as native Node modules).

reticulum-sidecar/rust-toolchain.toml pins stable and installs clippy, rustfmt, and llvm-tools-preview on the first cargo command run inside reticulum-sidecar/ (rustup auto-install). When cargo is on your PATH and sidecar-related paths are staged, pre-commit runs pnpm run check:reticulum-sidecar (full-feature fmt + Clippy + test with rns-stack,rns-ble,rns-rnode-tcp — no coverage).

Build the sidecar

From the repo root:

pnpm run reticulum:sidecar:build

This writes reticulum-sidecar/target/debug/mesh-client-reticulum (macOS/Linux) or .exe on Windows.

First-time / recover the stack workspace: from the mesh-client repo root, run ./scripts/clone-ratspeak-stack.sh. That script clones (or updates) the repo-local .rsstack/ workspace checkouts rsReticulum, rsLXMF, rsNomad, rsLXST, and lrgp-rs at the reviewed full SHAs in reticulum-sidecar/ratspeak-stack-pins.env, verifies each checkout, and then applies mesh-client overlays (fails if a pin cannot be fetched or a patch will not apply). For a local bisect only, set the relevant RS_*_REF plus MESH_CLIENT_ALLOW_RATSPEAK_REF_OVERRIDE=1; CI and release-channel builds reject overrides. The Nix flake reads the same pins file and overlay apply list.

When those .rsstack/ checkouts already exist, pnpm run reticulum:sidecar:build applies required overlays via scripts/ensure-rsReticulum-patches.sh before compiling with rns-stack,rns-ble,rns-rnode-tcp. See reticulum-sidecar/patches/README.md for overlay details.

First run in Electron dev: Reticulum → Connection → Start stack will run cargo build automatically if that binary is missing (first compile can take a few minutes). Pre-build with the command above to avoid waiting on the first click.

Run and verify

# Optional: run sidecar standalone (port 19437)
pnpm run reticulum:sidecar:dev

The standalone launcher creates a per-process API credential and sends it only over stdin. Check health through the Electron Connection panel or diagnostics; unauthenticated localhost requests are rejected.

In Electron dev: select RN (Reticulum, yellow) at the top of the rail → Connection → Start stack. Then use Network for identity (generate/import) and Connection for interfaces (add, edit, delete). Dev builds resolve the binary from reticulum-sidecar/target/debug/mesh-client-reticulum.

Keep Rust and the sidecar current

pnpm run update updates Node dependencies and:

  1. Syncs Flatpak vendored Electron archives to match package.json (scripts/sync-flatpak-electron.mjs)
  2. When cargo is available: runs rustup update (or brew upgrade rust if you use Homebrew rust without rustup) and rebuilds the sidecar with cargo build in reticulum-sidecar/

Scope: pnpm update / pnpm-lock.yaml changes are repo-local (commit the lockfile on your branch). The sidecar rebuild writes only to gitignored reticulum-sidecar/target/. Rust toolchain updates are not repo-scoped — rustup update refreshes the toolchain in your user profile (~/.rustup, ~/.cargo/bin), shared by any Rust project on the machine. The committed rust-toolchain.toml selects stable and required components for this crate; rustup applies it when you build or lint inside reticulum-sidecar/.

By default, pnpm run update keeps reticulum-sidecar/target/ so the next Electron Start stack or reticulum:sidecar:build stays warm. After a verify-and-walk-away run (or when reclaiming disk — often ~2–3G), opt in to a full cargo clean after a successful rebuild:

# Preferred
CLEAN_SIDECAR_TARGET=1 pnpm run update

# Equivalent flag (pnpm forwards args after --)
pnpm run update -- --clean-target

# Ad hoc anytime (does not run update)
pnpm run reticulum:sidecar:clean

Skip cleanup while iterating on sidecar Rust or Reticulum in Electron — the next build will be cold (several minutes).

Lint and coverage (sidecar)

Command When
pnpm run check:reticulum-sidecar Pre-commit full-feature fmt + Clippy + test (when cargo on PATH)
pnpm run reticulum:sidecar:clippy:full Before PR when editing reticulum-sidecar/**
pnpm run reticulum:sidecar:coverage Optional local HTML report (cargo install cargo-llvm-cov)

CI: full-feature lint in reticulum-sidecar.yaml; line-coverage threshold in tests.yaml when sidecar paths change (not pre-commit).

Further reading

Windows ARM64 release builds use a dedicated aarch64-pc-windows-msvc CI job (see .github/workflows/reticulum-sidecar.yaml).

Common pnpm commands

Use these from the repository root:

pnpm start rebuilds and uses the same verified mesh-client://renderer origin migration as installed builds. pnpm run dev explicitly uses Vite with COI headers and hot reload. Starting a Vite server alone does not redirect pnpm start. See the renderer startup matrix and smoke steps to verify each mode.

# App run/build
pnpm run dev
pnpm start
pnpm run build

# Platform packaging (binary artifacts in release/)
pnpm run dist:mac
pnpm run dist:linux
pnpm run dist:win

# Quality checks
pnpm run check:environment
pnpm run test:run
pnpm run test:coverage
pnpm run lint
pnpm run typecheck
pnpm run format:check
pnpm run check:i18n

# Maintenance
pnpm run update
pnpm run clean
pnpm run clean:build
pnpm run clean:build:full

# Reticulum sidecar (optional; requires Rust)
pnpm run reticulum:sidecar:build
pnpm run reticulum:sidecar:dev
pnpm run check:reticulum-sidecar
pnpm run reticulum:sidecar:clippy:full
pnpm run reticulum:sidecar:coverage

# Docs
pnpm run docs:install
pnpm run docs:build
pnpm run docs:serve

Both clean:build and clean:build:full (cross-platform; see scripts/clean-build.mjs) print the full list of what will be removed and always confirm with a Proceed? [y/N] prompt before deleting anything (default N; pass -y/--yes to skip, in which case the plan is still printed). They never run when stdin is not a TTY and -y is absent, so they cannot hang in CI.

  • clean:build (shallow) — removes build dists, test output, and caches (dist, dist-electron, release, coverage, .vitest-reports, test-results, playwright-report, .eslintcache). It keeps node_modules/ and the Reticulum sidecar, so pnpm run dev / pnpm start and the sidecar keep working. Use it to force fresh rebuilds, clear stale or corrupt intermediate output, or free modest disk without re-installing.
  • clean:build:full — removes everything above plus node_modules, reticulum-sidecar/target/, and the bundled sidecar binary (resources/reticulum-sidecar/), then runs pnpm install and pnpm run reticulum:sidecar:build so the environment is left in a working state. Use it to fix a corrupt/drifted node_modules, clear stale Rust incremental state after toolchain or overlay-patch changes, or reclaim up to ~20G+ of disk while restoring a known-good environment. The reinstall is skipped if nothing in tier 2 was actually present.

clean:build and clean:build:full are the cross-platform equivalents of make clean/deep clean; the repo's older Unix-only clean (clean above) remains for its narrower, rm -rf-style behaviour.

All Scripts Reference

Complete reference of all pnpm scripts in package.json, organized by category.

Build

Script Description
build Full production build: main (minified) + preload + renderer
build:main Build main process (no minify) → dist-electron/main/index.js
build:main:prod Build main process (minified) → dist-electron/main/index.js
build:main:meta Build main with metadata JSON (no minify) → dist-electron/main/metafile.json
build:main:minify-meta Build main with metadata JSON (minified) → dist-electron/main/meta.json
build:main:size Print main bundle size
build:preload Build preload script → dist-electron/preload/index.js
build:renderer Build renderer (React app) via Vite → dist/

Run

Script Description
dev Hot-reload dev mode: main/preload watch + Vite dev server + Electron
start Production-like local start: build then Electron with security warnings enabled
electron:open Launch Electron (requires prior build)
trace-deprecation Run with Node --trace-deprecation enabled

Package (distributables)

Script Description
dist Build for current platform → release/
dist:mac Build macOS x64 + arm64 .dmg + .zip + verify packaging (verify-mac-packaging.mjs stages ZIP install notice)
dist:mac:publish Build macOS and upload to release server
dist:linux Build Linux x64 + arm64 (.AppImage, .deb, .rpm) + verify packaging
dist:linux:publish Build Linux and upload to release server
dist:win Build Windows .exe installer (hoisted install workaround) + verify packaging
dist:win:publish Build Windows and upload to release server

dist:mac, dist:linux, and predist run dedupe:dist (scripts/dedupe-dist.mjs) before packaging; that helper retries on transient @jsr/_tmp_* rename races. dist:win uses scripts/dist-win-hoisted-install.mjs and restores node_modules afterward. CI packaging-smoke also runs a headless Linux AppImage launch check (scripts/test-linux-appimage-launch.mjs) — see CI/CD — Packaging smoke builds.

Building a Flatpak (Linux)

Flatpak builds use flatpak-builder directly (not a pnpm script) and require a one-time local setup. The GitHub Actions workflow (flatpak.yaml) handles this in CI automatically; the steps below are for local iteration.

1. Install system tools (Debian/Ubuntu)

sudo apt install flatpak flatpak-builder elfutils

1. Install system tools (Fedora)

sudo dnf install flatpak flatpak-builder elfutils

2. Add Flathub and install runtimes (one-time, ~500 MB)

flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y flathub org.freedesktop.Platform//24.08
flatpak install --user -y flathub org.freedesktop.Sdk//24.08
flatpak install --user -y flathub org.freedesktop.Sdk.Extension.node22//24.08
flatpak install --user -y flathub org.electronjs.Electron2.BaseApp//24.08

3. Generate offline pnpm sources (re-run whenever pnpm-lock.yaml changes)

# Prefer the CI pin with --force-reinstall (images may preinstall an older 0.1.0).
# See scripts/flatpakPnpmStoreVersion.mjs FLATPAK_NODE_GENERATOR_GIT.
pip install --force-reinstall --no-cache-dir \
  "git+https://github.com/flatpak/flatpak-builder-tools@ac5a296ac6111aa2319daf532f609a067b88d8a9#subdirectory=node"
# Skip Playwright browser vendoring (GitHub /raw/ 404s; Electron E2E skips downloads).
# Also skips Electron linux-armv7l archive lookup for Electron >= 44 (those zips are no
# longer published; Flatpak only ships x64 + arm64).
node scripts/patch-flatpak-node-generator-playwright.mjs
# Fail fast: version lookup / lockfile extraction must succeed before the generator.
set -euo pipefail
# Must match store layout for packageManager (pnpm 11/12 → v11). Generator defaults to v10.
# pnpm 12 may write a two-document lockfile; generator only accepts one document.
STORE_VERSION="$(
  node --input-type=module << 'EOF'
import fs from 'node:fs';
import { storeVersionFromPackageManager } from './scripts/flatpakPnpmStoreVersion.mjs';
// Failure point: missing/invalid packageManager → null (generator would get a bad --pnpm-store-version).
// Fallback: exit non-zero under set -e so flatpak-node-generator never runs.
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const storeVersion = storeVersionFromPackageManager(pkg.packageManager);
if (storeVersion == null) {
  throw new Error(
    `storeVersionFromPackageManager returned null for packageManager=${JSON.stringify(pkg.packageManager)}`,
  );
}
console.log(storeVersion);
EOF
)"
node --input-type=module << 'EOF'
import fs from 'node:fs';
import { extractProjectPnpmLockfile } from './scripts/flatpakPnpmStoreVersion.mjs';
fs.mkdirSync('flatpak', { recursive: true });
fs.writeFileSync(
  'flatpak/pnpm-lock.project.yaml',
  extractProjectPnpmLockfile(fs.readFileSync('pnpm-lock.yaml', 'utf8')),
);
EOF
flatpak-node-generator pnpm flatpak/pnpm-lock.project.yaml \
  --pnpm-store-version "$STORE_VERSION" \
  -o flatpak/generated-sources.json

flatpak/generated-sources.json is generated automatically in the flatpak.yaml CI workflow and does not need to be committed. For local builds you generate it manually as shown above; the file is only required locally and in a Flathub submission repo.

PR-cycle offline check (not pre-commit): after installing flatpak-node-generator, run pnpm run check:flatpak-offline-pnpm to assert the workflow passes the correct --pnpm-store-version and that generated sources cover lockfile tarballs (catches ERR_PNPM_NO_OFFLINE_TARBALL). CI / act:pr / release.sh run this automatically.

Offline install inside the Flatpak sandbox uses scripts/flatpak-pnpm-install.mjs, which retries transient @jsr/_tmp_* rename races (same root cause as Windows dist:win hoisted installs).

3b. Bundle Reticulum sidecar (required for Reticulum tab in the Flatpak; CI does this automatically)

The manifest copies resources/ into the app, including resources/reticulum-sidecar/mesh-client-reticulum. Before flatpak-builder, build the sidecar and install the binary there:

pnpm run reticulum:sidecar:build
install -Dm755 reticulum-sidecar/target/debug/mesh-client-reticulum \
  resources/reticulum-sidecar/mesh-client-reticulum

For a release-quality local Flatpak, use cargo build --release with rns-stack,rns-ble,rns-rnode-tcp (see Reticulum sidecar).

4. Build and install locally

flatpak-builder --user --install --force-clean build-dir org.coloradomesh.MeshClient.yml

This installs the app into your user Flatpak store.

5. Run

flatpak run org.coloradomesh.MeshClient

6. Produce a .flatpak bundle (for sharing without a repo)

flatpak build-bundle ~/.local/share/flatpak/repo \
  org.coloradomesh.MeshClient.flatpak \
  org.coloradomesh.MeshClient stable

Installing a .flatpak file creates a one-off remote named like meshclient-origin (not flathub); that is expected. The ref branch is stable (release CI sets this; older artifacts used master). Version is shown in MetaInfo / flatpak info, not in the remote name.

Reinstall after downloading a new bundle

flatpak uninstall --user org.coloradomesh.MeshClient
flatpak install --user ./org.coloradomesh.MeshClient-aarch64.flatpak
flatpak run org.coloradomesh.MeshClient

Runtime issues (GPU, VMware guests): see Flatpak: vmwgfx: driver missing (VMware on macOS).

Launch failures on Arch/CachyOS Wayland: see Flatpak: immediate exit on Arch / CachyOS / Wayland (#598).

Lint the manifest before submitting to Flathub:

flatpak run --command=flatpak-builder-lint org.freedesktop.Sdk \
  manifest org.coloradomesh.MeshClient.yml

Test

Script Description
test Run tests in watch mode (Vitest)
test:run Run tests once (CI mode)
test:coverage Run tests once with V8 coverage report
coverage:hotspots Worst files by uncovered lines from coverage/coverage-summary.json (run test:coverage first)
test:verbose Run tests with verbose output

Lint / Format

Script Description
lint Run ESLint (type-aware, zero warnings)
lint:fix Run ESLint with auto-fix
lint:md Run markdownlint-cli2 on all .md files
format Format all code via Prettier + sort package.json
format:check Check formatting without fixing

Typecheck

Script Description
typecheck TypeScript check: renderer + main process
typecheck:strict-shared Strict TypeScript (noUncheckedIndexedAccess + exactOptionalPropertyTypes) for src/shared
check:pr Comprehensive local gate: lint + typecheck + strict-shared + full test:run (+ path-aware sidecar)

Quality checks

Script Description
check:actions Lint .github/workflows with the github-actionlint devDependency
check:audit-ignores Warn when an ignored audit GHSA has a patch (needs network)
check:codeql-extensions Verify CodeQL extension allowlist for custom queries
check:console-log Fail on bare console.log in production paths
check:log-ids Require unique registered mcL#### on production console.warn/error
check:db-migrations Verify SQLite migrations are valid
check:electron-security Verify Electron security settings (CSP, sandbox, etc.)
check:environment Verify local dev prerequisites (run after clone)
check:fallow Changed-file dead-code / complexity / duplication audit (fallow audit --type-aware)
check:flatpak Lint Flatpak manifest and wrapper scripts
check:flatpak-offline-pnpm PR/release offline Flatpak pnpm store vN + lockfile coverage
check:i18n Verify English keys, unused keys, and locale quality rules
check:i18n:branch Run i18n quality checks on keys new/changed vs HEAD only
check:insecure-temp-files Predictable os.tmpdir() writes (CodeQL js/insecure-temporary-file)
check:ipc-contract Verify IPC channel contracts between main/preload/renderer
check:licenses Allowlist dependency licenses (pnpm licenses list + SPDX policy)
check:log-injection Unsanitized error args in console.* under recursive src/main/** (includes debug)
check:log-panel-filter Verify log panel filter wiring
check:log-service-sinks Verify log service sink configuration
check:main-bundle Production main index.js size budget (same suite as bundle-size.yaml)
check:oxlint Fast ESLint-compatible lint pass (correctness + suspicious + perf errors)
check:pinned-majors Warn when a pinned override is behind a newer npm major (needs network)
check:protocol-string-gates Enforce protocol capability gates over string compares
check:reticulum-decommissioned-hubs Keep TS/Rust decommissioned hub lists aligned
check:reticulum-interface-modes Keep TS/Rust Reticulum interface-mode catalogs aligned
check:reticulum-sidecar Full-feature cargo fmt + Clippy + test (skips when cargo missing)
check:semgrep Semgrep p/typescript p/javascript p/nodejs p/security-audit + .semgrep.yml (local pre-commit / release; not GitHub Actions)
check:silent-catches Detect empty or unlogged catch blocks
check:url-hostname-sanitization Verify URL hostname sanitization helpers
check:xss-patterns Detect risky DOM/HTML sink patterns

Documentation

Script Description
docs:install Install MkDocs Python dependencies
docs:build Build static docs to site/
docs:licenses Regenerate docs/third-party-licenses.md (runs allowlist)
docs:serve Serve docs locally with live reload

CI (act)

Script Description
act:ci Run Linux CI workflow via act + containers (Podman preferred)
act:ci:native Run CI checks on the host (no container engine)
act:tests Run tests workflow via act + containers
act:tests:native Run test:coverage on the host
act:pr Run act:ci then act:tests (container)
act:pr:native Run native CI + tests on the host
act:build:linux Run build.yaml ubuntu leg via act + containers
act:build:linux:native Run dist:linux on the host
act:reticulum Reticulum sidecar Linux jobs via act
act:reticulum:native Reticulum sidecar stub cargo test / build on the host
act:flatpak Flatpak x86_64 workflow via act (slow; privileged)
act:pull-images Pre-pull Docker images for act (container mode)
act:list List container and native act targets

Setup / helpers

Script Description
clean Remove dist-electron, dist, and node_modules
clean:build Remove build dists, test output, and caches (keeps node_modules + sidecar); prompts [y/N] (default N)
clean:build:full Also remove node_modules + Reticulum sidecar build output, then reinstall deps + rebuild sidecar; prompts [y/N] (default N)
dedupe:dist Retrying dist dedupe (scripts/dedupe-dist.mjs; @jsr/_tmp_* races)
i18n:auto-translate Machine-translate missing locale keys (MyMemory default)
i18n:prune-unused Remove orphaned translation keys from locale files
rebuild Rebuild native Node modules for Electron
release Maintainer release script (scripts/release.sh)
reticulum:sidecar:build Build debug mesh-client-reticulum (requires cargo)
reticulum:sidecar:clippy Clippy stub build (-D warnings)
reticulum:sidecar:clippy:full Clippy with rns-stack,rns-ble,rns-rnode-tcp
reticulum:sidecar:coverage Optional HTML coverage via cargo llvm-cov (no CI threshold)
reticulum:sidecar:dev Run sidecar standalone on 127.0.0.1:19437
reticulum:sidecar:fmt cargo fmt in reticulum-sidecar/
reticulum:sidecar:fmt:check cargo fmt --check
reticulum:sidecar:test Full-feature cargo test (clones the .rsstack/ workspace if needed)
setup:build-deps Install native build dependencies
setup:dev First-run: required tools + hooksPath + check:environment + typecheck smoke
setup:dialout Add user to dialout group for serial port access (Linux)
setup:semgrep Install Semgrep (App login not required)
setup:yamllint Install yamllint (brew/apt/hash-locked pip)
update Update pnpm deps, Rust toolchain (rustup), rebuild sidecar

Lifecycle (automatic)

Script Description
preinstall Require pnpm 12+ (check-package-manager.mjs) then only-allow pnpm
postinstall Rebuild native Node modules for Electron + apply pnpm patches
prepare Enable git hooks (core.hooksPath = .githooks)
predist Run dedupe:dist before dist packaging

postinstall runs scripts/rebuild-native.mjs for Electron native addons and applies patchedDependencies from pnpm-workspace.yaml (Meshtastic JSR transports, MeshCore, readable-stream, usb, etc.). When bumping patched packages, update hashes under patches/ and keep WATCH_ENTRIES in scripts/update.sh in sync — see AGENTS.md.

pnpm run update also runs check_pinned_majors (scripts/check-pinned-majors.mjs), which warns when an overrides pin in pnpm-workspace.yaml has fallen behind a newer npm major — a stale undici: ^7.29.0 floor once withheld an upstream main-process crash fix. Caps that are correct because the consuming package forbids the newer major (or because the pin is a platform target, e.g. electron) are recorded with a reason in PINNED_MAJOR_EXCEPTIONS; add an entry there instead of silencing the warning. The check needs network access, so it is warn-only and is not part of pre-commit or check:pr.

It then runs check_audit_ignores (scripts/check-audit-ignores.mjs, also pnpm run check:audit-ignores), which looks up each advisory in pnpm-workspace.yaml → auditConfig.ignoreGhsas on the GitHub advisory API and warns once a patched release exists (or the advisory is withdrawn), so the exception can be backed out. Every ignore must carry an inline comment saying why it is unreachable. Like the pinned-majors check it is network-dependent and warn-only; set GITHUB_TOKEN / GH_TOKEN to avoid the unauthenticated rate limit.

Dependabot dependency updates

Automated dependency updates are configured in .github/dependabot.yml:

  • Schedule: Weekly on Saturdays
  • pnpm dependencies: Grouped PRs; electron separate, all other deps together
  • GitHub Actions: Grouped into one PR

Testing Dependabot PRs locally:

Always use pnpm to test dependabot PRs:

git checkout <dependabot-branch>
pnpm install --frozen-lockfile
pnpm run build
pnpm run test:run

Do not use npm install; it creates a package-lock.json and may not respect pnpm's lockfile format.

4) Test harness setup and local quality checks

This section is the project test harness setup.

Installed via pnpm install (from package.json):

  • vitest, @vitest/coverage-v8, and renderer/main test dependencies
  • @playwright/test (Electron E2E; browser downloads skipped via PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 in .npmrc)
  • eslint, typescript, typescript-eslint
  • github-actionlint (workflow linting; pnpm exec github-actionlint)
  • oxlint, fallow, fallow-type-aware (fast lint / type-aware changed-file audit gates in pre-commit)
  • prettier, prettier-plugin-sh, prettier-plugin-tailwindcss
  • markdownlint-cli2, vitest-axe

Not installed by pnpm (install separately when needed):

  • yamllint (required for check:environment and pre-commit YAML lint; pnpm run setup:yamllint or brew/apt/pip)
  • Semgrep (required locally for check:environment and always-on pre-commit check:semgrep; not run in GitHub Actions). Run git config core.hooksPath .githooks and pnpm run setup:semgrep (pin in scripts/requirements-semgrep.txt; brew/pipx/pip). App login is not required. Config is tracked at .semgrep.yml. Findings may be false positives — research before dismissing; if wrong for this repo, update .semgrep.yml or add a narrow nosemgrep with a reason (see scripts/check-semgrep.mjs). Semgrep and ESLint are separate: after Semgrep-driven edits, lint the touched files — nosemgrep does not replace eslint-disable (see AGENTS.md Semgrep × ESLint).
  • Rust / cargo + clippy (required for check:environment; prefer rustup; pnpm run setup:dev prints a non-interactive rustup recipe and can rustup component add clippy). Needed for the Reticulum sidecar — see Reticulum sidecar. rust-toolchain.toml installs clippy/rustfmt/llvm-tools-preview on first build in reticulum-sidecar/. Optional: cargo install cargo-llvm-cov for pnpm run reticulum:sidecar:coverage.
  • Podman or Docker (Docker-compatible engine) and act (optional for container CI — act:*; host CI uses act:*:native without a container engine)
  • Python 3 + venv + MkDocs Python deps (for docs checks/builds)

Vitest projects and worker allocation

vitest.config.mts defines three projects:

Project Environment Role
renderer-ui jsdom Component/hook tests with setup stubs
renderer-logic node Pure renderer unit tests (no setup)
main node Main, shared, preload, and script tests

Worker counts are derived in vitest.harness.mts via computeVitestMaxWorkers(cpuCount, ratio): jsdom workers use RENDERER_UI_CPU_RATIO because they are memory-heavy; node workers use NODE_WORKER_CPU_RATIO. Both pools floor at MIN_VITEST_WORKERS (currently 2) and cap effective CPU count at MAX_VITEST_CPU_COUNT (32). When tuning worker allocation, change those constants in the harness (not this doc). Shared Vite dependency inline lists (VITEST_CORE_DEPS, VITEST_SERVER_INLINE_DEPS) also live there — add new deps to the harness when tests need them inlined.

By default all three Vitest projects run in parallel (groupOrder: 0). On memory-constrained hosts, set VITEST_SEQUENTIAL_PROJECTS=1 to run renderer-ui first, then renderer-logic + main together (legacy behavior).

Pull-request CI selects merge-base-related tests across these project jobs. Merge-queue, main, manual, and unsafe-to-scope changes run all three with coverage and merge blob reports via pnpm run test:coverage:merge (see .github/workflows/tests.yaml).

Playwright Electron E2E

Standalone suite under e2e/ launches the unpackaged production build with Playwright’s Electron API (playwright._electron.launch), using resolveLocalElectronBin() and an isolated --user-data-dir (mesh-e2e-* under the OS temp dir). Specs cover startup, preload IPC, tabs, the per-protocol panel matrix (every rail section and sub-tab for Meshtastic, MeshCore and Reticulum), window lifecycle, protocol switch, settings relaunch, empty states, reload, locale, diagnostics shell, and save-dialog cancel — not BLE/serial/MQTT/hardware or Reticulum sidecar flows.

Command Purpose
pnpm run test:e2e:build pnpm run build then Playwright
pnpm run test:e2e Playwright only (requires existing dist-electron + renderer build)
pnpm run test:e2e:headed Headed Electron windows

Constraints:

  • workers: 1 — main uses requestSingleInstanceLock(); parallel launches flake.
  • Linux: set MESH_CLIENT_DISABLE_GPU=1 (harness does this); CI uses xvfb-run -a. Local headless Linux needs DISPLAY for direct pnpm run test:e2e, or wrap with xvfb-run -a (pnpm run check:environment warns when DISPLAY is unset).
  • Not wired into pre-commit, pnpm run test:run, or pnpm run check:pr. Daily + manual CI: .github/workflows/e2e.yaml. Path-filtered PR job: e2e-panels.yaml runs the panel matrix on Linux when renderer shell/panel code changes (not required).

Monolithic protocol runtimes (useMeshtasticRuntime, useMeshcoreRuntime) also use source contract tests (read .ts files and assert wiring strings) where full renderHook integration would require heavy BLE/MQTT mocking; see *.reconnect*.test.ts beside those runtimes. Another example: meshtasticRuntimeWireEffects.diagnostics.contract.test.ts asserts LocalStats / RF hop-SNR still call processNodeUpdate from meshtasticNodeSideEffects / meshtasticRawPacketSideEffects.

Browser dev without Electron

When you open the Vite dev URL in a plain browser tab (not the Electron window), installDevElectronApiStubIfNeeded() in src/renderer/main.tsx installs a no-op window.electronAPI stub (devElectronApiStub.ts). UI shell and most panels render, but RF connect, SQLite, MQTT IPC, and file dialogs require the Electron window. The console logs [dev] Installed browser electronAPI stub… when the stub is active.

Run these quality checks before opening a PR:

pnpm run test:run
pnpm run lint
pnpm run lint:md
pnpm run typecheck
pnpm run format:check
pnpm run check:i18n
# Reticulum sidecar (when editing reticulum-sidecar/**)
pnpm run reticulum:sidecar:clippy:full
pnpm run reticulum:sidecar:test

Other useful commands:

  • pnpm test (watch mode — reruns only changed test files)
  • pnpm run test:staged (pre-commit helper: Vitest related to staged files only)
  • pnpm run test:changed (one-shot tests for working-tree edits vs HEAD, including unstaged WIP)
  • pnpm run check:pr (before opening/updating a PR: full lint + typecheck + typecheck:strict-shared + full test:run)
  • pnpm run test:ui / test:logic / test:main (single Vitest project)
  • pnpm run test:coverage (CI coverage report; used by act:tests:native)
  • pnpm run coverage:hotspots (rank uncovered lines from coverage/coverage-summary.json)
  • pnpm run test:coverage:merge (merge sharded CI blob reports locally)
  • pnpm run reticulum:sidecar:coverage (optional local HTML; CI threshold in tests.yaml)
  • pnpm run test:verbose (verbose failures)
  • pnpm run check:i18n:branch (i18n quality on branch-diff keys only)
  • pnpm run i18n:auto-translate (fill missing keys)
  • pnpm run i18n:prune-unused -- --write (drop orphaned locale keys)

The pre-commit hook runs path-gated check:* steps plus staged-related Vitest — see Git hooks.

5) Building a distributable

Use the platform-specific packaging command:

pnpm run dist:mac   # macOS -> .dmg + .zip in release/
pnpm run dist:linux # Linux -> .AppImage + .deb in release/
pnpm run dist:win   # Windows -> .exe installer in release/

Output goes to the release/ directory.

macOS (dist:mac) runs electron-builder --mac --x64 --arm64 --publish never (Intel + Apple Silicon DMG/ZIP pairs), then node scripts/verify-mac-packaging.mjs. Verify stages 00-READ-ME-BEFORE-EXTRACTING-macOS-ZIP.txt for GitHub Releases, asserts both arch .dmg + .zip artifacts, deep-validates every archive (symlink-preserving ZIP extract via ditto -xk, DMG mount including IMPORTANT-Read-Me.txt), launcher/framework sizes, Squirrel/Mantle/ReactiveObjC framework symlinks, and bundled Reticulum sidecar — same checks CI packaging-smoke uses on downloaded artifacts. Developer ID–signed builds also run codesign --verify --deep --strict and xcrun stapler validate on the finished .app, plus codesign --verify --strict on the bundled Reticulum sidecar; unsigned or ad-hoc (non–Developer ID) local builds skip that gate and are still expected to pass verify. Building both arches is slower than a single-arch pack.

Optional macOS signing (release parity): export the same env vars CI uses before pnpm run dist:mac. dist:mac:publish requires them and also requires RELEASE_ID plus GH_TOKEN for an existing draft release; it builds with publishing disabled, verifies every artifact in required Developer ID mode, and only then uploads through the controlled release uploader.

export CSC_LINK='…' # base64 .p12 Developer ID Application cert
export CSC_KEY_PASSWORD='…'
export CSC_IDENTITY_AUTO_DISCOVERY=true
export APPLE_ID='…'
export APPLE_APP_SPECIFIC_PASSWORD='…'
export APPLE_TEAM_ID='…'
pnpm run dist:mac

When CSC_LINK is unset, local dist:mac can skip signing/notarization. Release workflow macOS jobs and dist:mac:publish fail closed unless the complete signing/notarization configuration is present and the app plus bundled sidecar match APPLE_TEAM_ID. See Release Process — macOS code signing and notarization.

Build analysis

Enforce the production main index.js budget (same suite as CI bundle-size.yaml):

pnpm run check:main-bundle

Pre-commit path-gates this when src/main/ or the esbuild main-build scripts are staged. On failure, follow the printed remediation: move bulky code into a sibling esbuild entry, prefer externals, analyze the metafile. Do not raise MAIN_BUNDLE_SIZE_BUDGET_BYTES unless the developer explicitly asks (agents must prompt — see AGENTS.md Bundle CI).

To analyze the main process bundle size and composition:

pnpm run build:main:minify-meta

This generates dist-electron/main/meta.json. Upload this file to esbuild's online analyzer to visualize:

  • Bundle size by dependency
  • Code that could be externalized
  • Minification effectiveness

6) Git hooks and pre-commit behavior

After pnpm install, repo hooks are enabled via core.hooksPath (see the prepare script in package.json). The pre-commit hook runs on every commit. Typical commits run staged-related Vitest only (pnpm run test:staged → vitest related on staged source/test files, optionally narrowed to matching Vitest projects). Unstaged WIP is ignored. Full typecheck still runs every commit; ESLint runs on staged JS/TS with --cache (CI still runs full-tree lint), oxlint runs on staged JS/TS using .oxlintrc.json, and fallow audit --type-aware --staged checks the change for introduced dead code/complexity/debt. Path-gated typecheck:strict-shared runs when src/shared/ (or tsconfig.strict.json) is staged. Several expensive check:* steps and pnpm audit / full-feature sidecar builds are path-gated.

ESLint: production src/** enforces no-unsafe-*; test files keep those off. no-unnecessary-condition is enforced for src/shared/** and src/renderer/lib/** only.

Green pre-commit does not replace PR CI: .github/workflows/tests.yaml runs merge-base-related tests on pull requests and fails closed to full Vitest when scoping is unsafe. The merge queue always reruns full Vitest with coverage. Use pnpm run check:pr for a comprehensive local gate before opening a PR.

Hook order (authoritative source: .githooks/pre-commit):

  1. If package.json or pnpm-lock.yaml is staged: pnpm install --frozen-lockfile
  2. Prettier on staged files only (not whole-tree pnpm run format unless you run it manually)
  3. markdownlint-cli2 on staged .md files only (not full pnpm run lint:md unless you run it manually)
  4. When package.json or pnpm-lock.yaml is staged: pnpm dedupe, re-stage pnpm-lock.yaml, then re-stage the originally staged paths
  5. When src/renderer/locales/en/translation.json is staged: pnpm run i18n:auto-translate (incremental vs HEAD English, not --all) and re-stage src/renderer/locales/ — see Internationalization
  6. ESLint on staged JS/TS with --cache (skip when none staged); oxlint on staged JS/TS (correctness + suspicious + perf as errors via .oxlintrc.json; skip when none staged)
  7. pnpm run typecheck (full tree); path-gated typecheck:strict-shared when src/shared/ or tsconfig.strict.json staged
  8. Always-on: check:electron-security, check:log-injection, check:log-service-sinks, check:codeql-extensions, check:insecure-temp-files, check:console-log, check:silent-catches, check:log-ids, check:semgrep (p/typescript, p/javascript, p/nodejs, p/security-audit, .semgrep.yml; findings may be wrong — research before dismissing, then update .semgrep.yml / narrow nosemgrep if truly incorrect), check:url-hostname-sanitization, check:xss-patterns, check:protocol-string-gates, check:log-panel-filter, check:licenses, fallow audit --type-aware --staged; check:i18n when English locale staged else check:i18n:branch
  9. Path-gated: check:flatpak, check:db-migrations, check:main-bundle (when src/main/ or esbuild main-build scripts staged), check:ipc-contract, check:reticulum-interface-modes, check:reticulum-decommissioned-hubs, check:reticulum-sidecar (when cargo on PATH and sidecar paths staged)
  10. pnpm audit --audit-level=high only when dependency manifests staged; pnpm exec github-actionlint when .github/workflows/* staged; yamllint when any *.yaml / *.yml staged
  11. pnpm run test:staged (scripts/precommit-tests.mjs: staged-only vitest related; full suite when vitest config/setup mocks or dependency manifests change; skip when no source/test staged)

Pre-push (branch gate) and why it repeats some checks

.githooks/pre-push runs pnpm run check:changed (scripts/prepush-check.mjs) over the union of origin/main…HEAD, staged, and unstaged paths: Prettier --check, ESLint with the CI shard/config (scripts/ci-eslint-shard.mjs), full typecheck, and vitest related for the whole branch diff.

It deliberately repeats work pre-commit already did, because the two gates answer different questions:

  • Scope: pre-commit only sees the files in that commit. Cross-commit interactions (a later commit touching a shared module whose consumers' tests were not staged) are only visible branch-wide.
  • Invocation: pre-push runs the same ESLint shard arguments as CI, so a staged-file local invocation cannot hide a config/ignore-driven CI failure.
  • Bypassed state: --no-verify, GUI clients, agent VMs with a non-repo core.hooksPath, and commits pulled or merged into the branch never ran your pre-commit. Pre-push is the last local gate.
  • Cost: a red PR costs a full CI round-trip; the branch check is the cheap version of that signal.

Tree-hash cache. The first successful branch check writes <git-dir>/prepush-check-cache.json, keyed by HEAD, the merge-base, the tracked diff vs HEAD (staged + unstaged), and untracked file hashes. Pushing the exact same tree again (push retry, second remote, no-op amend/rebase) skips instantly. Set PREPUSH_CHECK_NO_CACHE=1 or delete the cache file to force a rerun. The cache lives inside the git dir — never tracked, per worktree — and is only written after a passing run.

Emergency bypass (temporary only):

git push --no-verify

Release / protected CI full suite: pnpm run release (scripts/release.sh), merge-queue merge_group, main push, and manual tests.yaml runs always execute full Vitest. Pull requests use merge-base-related tests unless a safe fallback requires the full suite. Release also runs the ungated check:* set and requires actionlint (from pnpm install) + yamllint. Use pnpm run check:pr for the comprehensive Vitest/lint/typecheck surface locally before a PR.

Install hook dependencies via Helper scripts (yamllint via pip/brew/apt; actionlint comes with pnpm install).

Emergency bypass (temporary only):

git commit --no-verify

Run any skipped checks manually as soon as possible.

Local CI has two modes:

Mode Scripts Requires
Container pnpm run act:ci, pnpm run act:tests, … Docker-compatible engine + act (Podman preferred)
Host / native pnpm run act:ci:native, pnpm run act:tests:native, … Node/pnpm only

Container mode runs GitHub Actions jobs inside containers using a Docker-compatible engine (Podman Desktop preferred). Host mode runs the same pnpm/cargo steps directly — use this when no container engine is available or act cannot reach the daemon.

Install (container mode):

OS Container engine act
macOS Podman Desktop with Docker compatibility enabled brew install act
Linux Podman or Docker engine act releases
Windows Podman Desktop with Docker compatibility enabled choco install act-cli or releases
pnpm run act:pull-images # container mode only
pnpm run act:list
pnpm run act:ci    # or act:ci:native
pnpm run act:tests # or act:tests:native

On macOS, podman exposes a Docker-compatible socket at /var/run/docker.sock; pass that path to act via ACT_DOCKER_SOCKET, or let it auto-detect if Podman created the socket symlink. If you use Docker Desktop instead of Podman, its socket is typically under ~/.docker/run/docker.sock.

macOS and Windows installer builds still require native pnpm run dist:mac / pnpm run dist:win. See ci-cd.md.

  • actionlint: required for local pre-commit if workflow files are touched; provided by the github-actionlint devDependency (pnpm exec github-actionlint).

8) Helper scripts (auto-install where possible)

These scripts try to install required and optional tooling automatically. If they fail (for example, missing sudo/admin rights), follow the manual steps in this doc instead.

  1. Preferred one-shot after Node/pnpm exist (and again after pnpm install):
  2. pnpm run setup:dev — build-deps, Semgrep, yamllint, Rust/clippy hints, core.hooksPath=.githooks, then check:environment + typecheck smoke
  3. Verify your environment only:
  4. node scripts/check-environment.mjs (before pnpm install)
  5. pnpm run check:environment (after pnpm install)
  6. actionlint (used by the git pre-commit hook when workflows are staged):
  7. Comes with pnpm install via the github-actionlint devDependency; run pnpm exec github-actionlint.
  8. No separate install script or .githooks/bin entry is needed.
  9. Install yamllint (required by check:environment and the git pre-commit hook):
  10. pnpm run setup:yamllint
  11. Or: brew install yamllint / sudo apt install yamllint / hash-locked pip install --user --require-hashes --only-binary=:all: -r scripts/requirements-yamllint.txt
  12. Install Semgrep (required by check:environment and always-on pre-commit check:semgrep; not in GitHub Actions):
  13. pnpm run setup:semgrep
  14. Or: macOS brew install semgrep / pipx install semgrep / pip install semgrep
  15. Semgrep App login / SEMGREP_APP_TOKEN are not required.
  16. Policy file .semgrep.yml is tracked in git (do not ignore it).
  17. Install native build dependencies:
  18. pnpm run setup:build-deps
  19. Linux/macOS: attempts to install what native builds need (requires sudo where applicable).
  20. Windows: prints a message to install Visual Studio Build Tools manually.
  21. Install Rust (required for check:environment; prefer rustup):
  22. pnpm run setup:dev prints a non-interactive rustup recipe when cargo is missing and runs rustup component add clippy when needed.
  23. (Linux only) Fix serial port permissions:
  24. pnpm run setup:dialout
  25. Adds your user to the dialout group (requires sudo + re-login).

9) Internationalization (i18n)

The app uses i18next for localization. English is the source of truth.

  • Locale files: src/renderer/locales/{en,es,uk,de,zh,pt-BR,fr,it,pl,cs,ja,ru,nl,ko,tr,id}/translation.json
  • Adding strings:
  • Add the new key and English value to src/renderer/locales/en/translation.json.
  • Use the t('key.name') hook in React components.
  • Run pnpm run i18n:auto-translate to machine-translate the new key into other supported languages.
  • Run pnpm run check:i18n to verify all keys are valid and accounted for.
  • Removing strings: delete the English key, then run pnpm run i18n:prune-unused -- --write (or remove manually from every locale).

Auto-translation uses MyMemory by default. Incremental translations (new keys only) run automatically during the git pre-commit hook. Use pnpm run i18n:auto-translate --all to force a full re-scan of all missing keys. Use pnpm run check:i18n:branch before large doc-only PRs to lint keys changed vs HEAD without the full unused-key pass.

10) Optional editor/tooling

  • VS Code (or Cursor) with TypeScript + ESLint support
  • Prettier editor extension (optional convenience; repository already defines formatting rules)
  • React DevTools for renderer debugging

macOS

Electron 44 (this repo’s runtime) requires macOS 13 Ventura or later for both pnpm run dev and packaged builds. Monterey hosts are unsupported.

Install prerequisites

  1. Install Git (Xcode CLT includes it):
    xcode-select --install
    
  2. Install Node 22 (22.15.0+ recommended via nvm) and npm:
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh -o install_nvm.sh

less install_nvm.sh
bash install_nvm.sh
rm install_nvm.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 22
nvm use 22

Build/run flow

git clone https://github.com/Colorado-Mesh/mesh-client
cd mesh-client
pnpm install
pnpm run dev

Local CI container engine

Podman Desktop is the preferred cross-platform Docker-compatible engine for local CI. When Docker compatibility is enabled, Podman exposes a Docker-compatible socket at /var/run/docker.sock; pass that path to act via ACT_DOCKER_SOCKET, or let it auto-detect if Podman Desktop created the socket symlink. If you use Docker Desktop instead, see the socket note above.

Bluetooth permissions

On first BLE connection, macOS prompts for Bluetooth access. If denied accidentally:

  • Go to System Settings > Privacy & Security > Bluetooth
  • Enable access for Mesh-Client

Reticulum sidecar (optional)

If you work on the Reticulum protocol tab, install Rust and build the sidecar — see Reticulum sidecar (optional) above. On macOS, rustup is preferred over brew install rust (CI parity); do not install both.

macOS release-download note (not required for source development)

If a downloaded app reports "Mesh-client is damaged and can't be opened", see macOS: File is damaged and cannot be opened. If launch fails with Library not loaded: Squirrel.framework after extracting the macOS ZIP with 7-Zip, see macOS: Squirrel.framework after ZIP extract.

Windows

Install prerequisites

  1. Install Git and Node.js (winget primary path):
    winget install git.git
    winget install OpenJS.NodeJS
    
  2. Allow npm script execution in current user scope:
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
    
  3. Install Visual Studio Build Tools with Desktop development with C++ workload.
  4. Install Python 3 and ensure it is on PATH:
    winget install Python.Python.3.12
    
    If needed, set npm Python path explicitly:
    npm config set python "C:\\Path\\To\\python.exe"
    

Build/run flow

git clone https://github.com/Colorado-Mesh/mesh-client
cd mesh-client
pnpm install
pnpm run dev

Windows packaging note

The Windows build (dist:win) uses pnpm's node-linker=hoisted mode to work around asar packaging issues on Windows. The build command automatically reinstalls with hoisted mode, packages, then restores the default structure.

Serial device driver reminder

If serial ports do not appear, install the right USB UART driver (for example CH340/CH341, CP210x, or FTDI).

Troubleshooting

See Build troubleshooting (Visual Studio), Python, and dist:win path / EPERM.

Linux

Install prerequisites

Install Node 22 (22.15.0+ recommended), make, and C++ build tools (g++/gcc-c++) with native build dependencies.

NixOS: use nix develop instead of the package lists below; see Nix (NixOS and macOS).

Debian/Ubuntu:

curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 22
nvm use 22
sudo apt install build-essential
sudo apt install python3 libnspr4 libnss3

Fedora/RedHat:

curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 22
nvm use 22
sudo dnf install @development-tools
sudo dnf install python3 nspr nss

Build/run flow

git clone https://github.com/Colorado-Mesh/mesh-client
cd mesh-client
pnpm install
pnpm run dev

Serial permissions

Add your user to dialout:

sudo usermod -a -G dialout $USER

Log out/in after changing groups.

Linux Bluetooth (BLE)

LoRa BLE uses the reticulum-sidecar btleplug GATT stack on Linux (same as macOS/Windows) — not Web Bluetooth / Noble.

  • Requires a working BlueZ stack (systemctl status bluetooth, rfkill list)
  • Flatpak builds need Bluetooth allowed (--allow=bluetooth + --system-talk-name=org.bluez)
  • In-app PIN pairing (Meshtastic / MeshCore) uses BlueZ D-Bus from Electron main (src/main/linux-bluez/), not bluetoothctl
  • ATT MTU / write sizing follows sidecar negotiation via bleAttWriteLimit.ts (spec min 23)

Pairing failures and BlueZ steps: BLE known issues.

Linux launch notes

The supported dev and local run flows are:

pnpm run dev
pnpm start

ARM (for example Raspberry Pi) may also require:

sudo apt install zlib1g-dev libfuse2
sudo sysctl -w kernel.unprivileged_userns_clone=1

Troubleshooting

See Linux development: SIGILL / SIGSEGV and Linux: serial port access denied.

Nix (NixOS and macOS)

The repo-root flake.nix supports x86_64-linux, aarch64-linux, and aarch64-darwin. It is the supported way to develop on NixOS, where the Electron binary that pnpm install downloads cannot find its dynamic libraries.

Command Result
nix run / nix run .#mesh-client Build the packaged app and launch it
nix build .#mesh-client Build the app to ./result (gitignored, along with result-*)
nix build .#reticulum-sidecar Build only mesh-client-reticulum (features rns-stack,rns-ble,rns-rnode-tcp)
nix develop Enter a dev shell with Node.js, pnpm, Rust, and Python, then run pnpm install && pnpm run dev

On Linux, nix develop opens an FHS environment that carries Electron's runtime libraries (GTK, NSS, Mesa, BlueZ D-Bus, udev, and others), so the regular pnpm workflow and pre-commit hooks work unchanged. On macOS it is a plain shell, because the downloaded Electron runs natively.

How the flake stays in sync with the rest of the build:

  • App version is read from package.json, so pnpm run release needs no flake change.
  • Reticulum stack sources are fetched at the SHAs in reticulum-sidecar/ratspeak-stack-pins.env, and overlays are applied from scripts/lib/ratspeak-overlay-apply-list.sh. These are the same inputs scripts/clone-ratspeak-stack.sh uses. Pin bumps and new overlays need no flake.nix or flake.lock edit.
  • Toolchain majors: the flake uses the nixpkgs attributes electron_<major>, pnpm_<major>, and nodejs_<major>. These must match devDependencies.electron, packageManager, and engines.node in package.json. Building the flake fails with an Electron mismatch, and scripts/flake-stack-pins.test.mjs fails on any mismatch. When one of those majors changes, update the attribute in flake.nix. If the locked nixpkgs does not have the new attribute yet, run nix flake update and commit flake.lock.
  • Pre-commit and PR CI run scripts/flake-stack-pins.test.mjs whenever flake.nix, the pins file, scripts/clone-ratspeak-stack.sh, or the overlay apply list changes (scripts/precommit-tests.mjs). No CI job evaluates or builds the flake.

Build troubleshooting

Clone, compile, and local packaging issues. Runtime problems with the packaged app are in Troubleshooting.

pnpm install fails on native module compilation

See development-environment.md for OS-specific prerequisite installation.

Windows: "Could not find any Visual Studio installation to use"

See development-environment.md for required build tools and the full recovery steps.

Windows: "Could not find any Python installation to use" (e.g. when building @serialport/bindings-cpp)

See development-environment.md for Python setup and npm/node-gyp troubleshooting.

Linux development: SIGILL during pnpm install

Symptom: electron exited with signal SIGILL during install/rebuild (common in sandboxes or VMs without instructions the prebuilt Electron binary expects).

Fix:

MESHTASTIC_SKIP_ELECTRON_REBUILD=1 pnpm install
pnpm run rebuild

Run pnpm run rebuild on a host where the bundled Electron binary executes correctly.

Linux development: SIGSEGV on startup

Symptom: electron exited with signal SIGSEGV when running from source (GPU process; see electron#41980).

Fix:

pnpm run build && pnpm dlx electron . --disable-gpu

Or:

pnpm run electron:open -- --disable-gpu

Optional persistent mitigation:

  • export MESH_CLIENT_DISABLE_GPU=1
  • ELECTRON_OZONE_PLATFORM_HINT=x11 pnpm run electron:open

"A native module failed to load" dialog on startup

Cause: A native addon (e.g. @serialport/bindings-cpp) was compiled for a different Electron ABI; common after an Electron or Node version change.

Fix: Run pnpm install (the postinstall script rebuilds native modules for the correct ABI automatically).

  • If you still see dlopen errors after switching machines or OSes, delete node_modules and run a clean pnpm install.
  • Windows: Also ensure the Visual C++ Redistributable is installed.

pnpm run dist:mac fails with GH_TOKEN / "Cannot cleanup"

electron-builder publishes to GitHub when it thinks it's in CI. Local builds use --publish never so artifacts land in release/ without a token. Tag release CI also builds with dist:* (--publish never) and attaches via ci-upload-release-assets.mjs to the prepare draft; see .github/workflows/release.yaml.

[DEP0190] when running electron-builder

Node deprecates spawn(..., { shell: true }) with an args array. This project carries the packaging workaround via pnpm patchedDependencies on transitive packages used by the Electron build path. Re-run pnpm install if you upgrade electron-builder or its transitive packaging deps and the warning returns.

duplicate dependency references during dist

npm's JSON tree lists hoisted packages with many duplicate refs (one per edge). That's expected and not something you need to fix. The patched packaging dependency path keeps that summary at debug only so normal dist:* runs stay quiet. To see it: DEBUG=electron-builder pnpm dlx electron-builder --mac (or your usual dist command).

dist:win fails with "space in the path" or EPERM on native modules

Symptoms

  • Attempting to build a module with a space in the path during pnpm run dist:win (or pnpm run rebuild).
  • EPERM: operation not permitted when the rebuild tries to replace a locked .node file.

Cause

  1. Spaces in the project path: node-gyp is unreliable when the repo lives under a path with spaces (e.g. C:\Users\Joey Stanford\mesh-client). This can surface as "Attempting to build a module with a space in the path", "Could not find any Visual Studio installation to use", or EPERM. See node-gyp#65.
  2. EPERM on unlink: Something on Windows still has the .node file open (another node/electron process, antivirus/Windows Defender scanning the file, or a stuck handle).

Fix

  1. Use a path without spaces (strongly recommended): clone or copy the repo to e.g. C:\dev\mesh-client, then pnpm install and pnpm run dist:win from there.
  2. Clear the lock before rebuild: quit any running Mesh-Client/Electron dev instances, then delete the affected build folder under node_modules and retry.
  3. Rebuild then dist: pnpm run rebuild; if that succeeds, run pnpm run dist:win.

CI builds avoid both issues by using short paths and clean agents; local Windows builds need the same constraints.

Windows: 0x80010135 / "Path too long" (e.g. bluetooth_hci_socket.lastbuildstate)

Symptoms

  • Explorer or the compiler shows error 0x80010135 with Path too long, often on a *.lastbuildstate file under node_modules.
  • bluetooth_hci_socket in the name points at @stoprocent/bluetooth-hci-socket (a native dependency of @stoprocent/noble). MSBuild writes build state under very deep paths; together with a long clone directory, the full path can exceed the legacy ~260 character Win32 limit.

Fix (use one or more)

  1. Shorten the repo path (most reliable): clone or copy the project to a shallow path such as C:\dev\mesh-client instead of e.g. C:\Users\…\Documents\GitHub\org\mesh-client.
  2. Enable long paths in Git (helps clones/checkouts): git config --global core.longpaths true, then re-clone or ensure no stuck long paths in the worktree.
  3. Enable Win32 long paths in Windows (Windows 10 1607+): this option is not available as a normal toggle in Settings; enable it via Local Group Policy → Computer Configuration → Administrative Templates → System → Filesystem → Enable Win32 long paths, or set the registry DWORD LongPathsEnabled = 1 under HKLM\SYSTEM\CurrentControlSet\Control\FileSystem (admin rights; reboot may be required). See Microsoft: Maximum Path Length Limitation.
  4. pnpm run dist:win already runs a hoisted pnpm install to shorten node_modules depth before packaging; if pnpm install / pnpm run rebuild fails earlier with this error, try the short path and long-path OS settings first, or temporarily: pnpm install --config.node-linker=hoisted from a short root path.

[DEP0169] / url.parse() deprecation warning

The app uses npm package overrides to force follow-redirects and cacheable-request onto versions that use the WHATWG URL API, which removes this warning. To trace the source of any deprecation, run:

pnpm run trace-deprecation