Hangar's original code is licensed under the GNU General Public License, version 3 or (at your option) any later version: GPL-3.0-or-later. See LICENSE; third-party components retain the licenses in THIRD-PARTY-NOTICES.md. Private vulnerability reports: SECURITY.md. Change and verification ledger: PROVENANCE.md.
Lightweight QEMU virtual-machine manager with a web UI and an optional native
WebView desktop wrapper. No libvirt. Single Zig daemon serves the HTTP API, the
embedded web UI, and the remote control protocol; vmrun is a CLI client.
Running a handful of QEMU VMs on a workstation usually means one of two things:
hand-written qemu-system-* command lines that nobody can remember, or libvirt
with its daemon, XML domain format, and policy layers. Hangar keeps QEMU's
process model and drops everything else: one static binary owns the VM configs
(a single JSON file), spawns QEMU directly, and talks QMP for guest control.
The web UI is embedded in that binary (zig build bundles it with Bun), so
zig build web and a browser is the whole install.
- Create, clone (full or linked), rename, delete (with undo), import VMs.
- Power on/off, suspend/resume, pause, reset, snapshots (take/revert/delete), live CD/ISO change, disk resize/compact, secondary + extra disks, OVF export.
- Browser consoles: VNC (noVNC) and SPICE (spice-html5) with a WebGPU/WebGL2 presenter, plus a real xterm.js serial terminal, all in the Console tab.
- Optional hardware-accelerated H.264 video streaming of the guest display to
the browser via WebCodecs (see
docs/VIDEO-PIPELINE.md). - Virtual networks (NAT/host-only/bridged) with a visual topology view.
- Host dashboard, sortable inventory, folders, tags, command palette (Ctrl+K), multi-select bulk operations, light/dark themes, live updates over SSE.
- Zig 0.16.0 (the build pins backend/linker flags for this version).
- libvncclient development headers and library, including
rfb/rfbclient.h, plus pkg-config and the platform C development toolchain. - Bun 1.4.0 and ShellCheck for the CI lint checks. Bun is also used for e2e tests.
- QEMU (
qemu-system-x86_64,qemu-img);cloud-localdsfor cloud-init,swtpmfor TPM, OVMF for UEFI, all optional per feature. - For the encoded-video pipeline:
ffmpeg(usesh264_vaapiwhen a/dev/dri/renderD*node is available, elselibx264). - For e2e tests:
bun install --frozen-lockfileand Chromium (bun run e2e:install). The shell integration tests also need Python 3 and curl.
With Zig 0.16.0 and Bun 1.4.0 on PATH, install the build/check dependencies
(the VNC package provides both the client headers and library):
sudo apt-get update sudo apt-get install --no-install-recommends -y build-essential libvncserver-dev pkg-config shellcheck
From the clone's root, run the same build, format, lint, and unit/fuzz gates as CI:
zig build check
These checks do not require bun install or Chromium. The first Zig build fetches
its pinned dependencies. Build output goes to zig-out/bin/; no global install
is needed. Install QEMU separately before creating or powering on VMs.
zig build web # build + launch the web backend (HTTP on :9080) zig build webui # build + launch the native WebView desktop wrapper zig build test # all hermetic unit + fuzz tests (no network/browser) zig build web-e2e # Playwright web UI e2e (standalone; needs bun + chromium) zig build test-api # HTTP API integration test (spawns a real daemon) zig build test-vmrun # vmrun CLI integration test (spawns a real daemon)
Use zig build --help to list build steps. For a shorter edit/test loop, run a
single module (including its imported tests) with the suite's linker flags,
libraries, and module imports:
zig build test-unit-persist zig build test-unit-vnc_client zig build test -Dtest-filter="secondary NIC modes" # one test by name substring
Every registered module has a test-unit-<module> step. test-unit-vmrun runs
the CLI unit tests; test-vmrun runs the standalone daemon integration suite.
Tests live at the bottom of each Zig module; register new test modules in
build.zig. Before opening a pull request, run zig build check to also catch
errors reachable only through the executables. Web workflow changes additionally
need a Playwright test under tests/e2e/ and a zig build web-e2e run.
Open http://127.0.0.1:9080 after zig build web. A daemon started without
KV_API_KEY binds the IPv4 loopback, so address it as 127.0.0.1, not
localhost (which resolves to ::1 on most distributions).
The UI is Preact, Tailwind v4 and shadcn-style components under src/web/ui,
bundled by Bun into src/web/dist (gitignored) and embedded in the daemon.
zig build runs the bundle step itself; these commands cover the rest:
bun install --frozen-lockfile # once, plus `bun run e2e:install` for Chromium bun run build:web # bundle src/web/ui into src/web/dist (ui.js, ui.css, icons.svg) bun run lint # oxlint (strict, anti-slop, shadcn) over the UI, scripts and tests bun run typecheck # tsc --noEmit bun run test # bun test over the UI's pure logic zig build web-e2e # Playwright against the built daemon
Rebuild with zig build after a UI change: the bundle is embedded in the
executable, so a running daemon serves the old UI until it is rebuilt.
Design tokens live in src/web/ui/styles.css (bun run check:contrast
checks the palettes); the UI layout is described in src/web/ui/AGENTS.md.
vmrun talks to the same daemon over HTTP or a Unix socket. A real session:
$ vmrun http://127.0.0.1:9080 create web-01 4096 4 40 create web-01: ok $ vmrun http://127.0.0.1:9080 list [0] web-01 status=stopped mem=4096MB cpu=4 [1] db-primary status=stopped mem=8192MB cpu=8 $ vmrun http://127.0.0.1:9080 info web-01 VM [0] web-01 Status: stopped Guest: Linux Memory: 4096 MB CPU: 4 cores Disk: 40 GB Network: user
vmrun --help lists all 30 commands (power, snapshots, disks, migration,
import/export). Set KV_API_KEY in the environment to reach an exposed daemon.
Working and covered by tests: the VM lifecycle (create, clone, rename, delete
with undo, import, OVF export), power and guest control over QMP, snapshots,
disk resize/compact, virtual networks, live migration, the browser consoles
(VNC, SPICE, serial), and the vmrun CLI. docs/GAP-ANALYSIS.md tracks
feature-by-feature parity with VMware Workstation 17.
Partial: the H.264 video pipeline needs a dbus display and ffmpeg, and falls
back to libx264 without a VAAPI render node (docs/VIDEO-PIPELINE.md).
Window geometry is still persisted in Prefs but no current frontend restores
it, a leftover from the removed FLTK desktop UI.
Not built: TLS termination (front the daemon with a reverse proxy), multi-user
accounts, and any hypervisor backend other than QEMU, though the process
lifecycle already goes through a dispatch table (src/hv/).
v0.6.0 is the latest tagged release. build.zig.zon and the private
frontend-test package.json declare 0.6.0. There is no stated compatibility
or deprecation policy.
vmrun schemaprints a CLI Spec 0.3 document and needs no daemon, no config, and no network.vmrun schema <command>returns that document filtered to the command.-o/--outputacceptauto,text, orjsonbefore the command.autostays text on a pipe.--versionprints{"version":"0.6.0"}when JSON mode is explicit. A usage exit (2) or a failure exit (1) then ends with an error object on stderr when JSON mode is explicit.vmrun -o json listprints{"items":[...],"total":N}. Other commands keep their existing stdout.KV_API_KEYstays an environment variable.
- The web UI is now typed Preact components styled with Tailwind v4, bundled by
Bun during
zig buildand embedded in the daemon. The hand-writtenapp.js,app.css,van.jsand the inline icon sprite are gone. The daemon API, the strict CSP and every request payload are unchanged. - Design tokens (colors, radius, fonts) live in one Tailwind
@themeblock. Icons come fromassets/iconsand are served as/icons.svg. - Keyboard and screen-reader fixes: VM rows are buttons with the favorite star beside them (axe reported a button inside a listbox option), tab bar Arrow/Home/End, and contrast fixes for selected rows, the active settings section and the hovered primary button. Toast icons now render.
- Preferences now shows the saved values (it read the wrong keys before). Virtual network validation is stricter and the editor refuses to open when the network list fails to load, so a failed load can no longer be saved back as an empty set.
- Display-only mode no longer shows a blank screen, and the console "client failed to load" Retry button is now visible.
- Lighthouse scores 100 for accessibility and best practices, and an axe check over the main views and every dialog runs in the e2e suite.
docs/BRAND.md(tokens, palette with contrast ratios, logo, voice),docs/brand/icons.html(icon index),bun run check:contrast.- Web UI development commands in this README:
bun run lint,typecheck,test,build:web.
- Console clients (noVNC, SPICE) and terminal bundles (xterm.js) now load on demand when opening the Console tab rather than at initial page load, and revalidate using HTTP ETag / If-None-Match headers.
- Context menus, dialogs, and status messages are fully reachable and navigable by keyboard with standard ARIA roles and tab indexing.
- Text glyphs and emoji across the web UI are replaced with consistent design token styles and SVG sprite icons.
- Unified memory unit conventions (MB/MiB) across inventory, dialogs, and CLI.
- Comma characters (
,) are rejected in VM names and disk paths to prevent QEMU CLI argument parsing collisions and injection vulnerabilities. - Shared unified Content-Length validation and path parsing across HTTP handlers and CLI transport.
- Upload stream prefix rescanning is removed to reduce CPU churn on large image transfers.
- Overflow-safe bounds calculation for VNC damage rectangles.
- Added
-Dtest-filteroption to filter tests by substring across test suites. - Added YAML linting with
yamllint(zig build lint-yaml) to the blocking CI analysis step. - Optimized CI caching for Zig build artifacts across commits.
- Added
THIRD-PARTY-NOTICES.mddocumenting licenses and sources of third-party code.
No functional changes since v0.2.0. No other branches were merged. Version
strings on the daemon, vmrun, and the native wrapper match this tag. The
v0.2.0 upgrade and rollback precautions still apply.
v0.1.0 accepted non-ASCII bytes in KV_API_KEY, despite documenting an
ASCII-only value. The daemon now rejects those keys and exits with an error.
The native wrapper also rejects invalid keys before spawning the daemon;
vmrun rejects them before connecting, with an error naming KV_API_KEY.
Only an unset variable selects the client's built-in default. In v0.1.0,
vmrun silently substituted that default for empty, overlong, or
whitespace-containing keys; those client configurations now fail with exit code 1.
Before upgrading either the daemon or its clients, replace any non-ASCII key
with a strong, unique secret of 1–64 printable ASCII bytes, excluding spaces
(! through ~). Set the same replacement in the daemon and every client's
KV_API_KEY environment, then restart them. The replacement also works with
v0.1.0, so rotate it there first if upgrading clients and daemon separately.
Do not unset the key or use hangar as a workaround: those values leave the
daemon loopback-only. Existing valid ASCII keys need no change.
In v0.1.0, Hyper-V Enlightenments forced QEMU's host CPU regardless of the
saved CPU Model. The next QEMU start now uses the selected model with the
Hyper-V properties appended, subject to the fallback below.
With Auto or TCG acceleration, Host and Host Passthrough selections now emit
QEMU's max model instead of host, whether or not enlightenments are enabled.
The substitution applies to Auto even when KVM is available; it permits TCG
fallback, where host cannot start. The saved CPU selection is not rewritten.
Explicit hardware acceleration still preserves Host selections.
To retain the previous host launch configuration on a Linux KVM host, set
CPU Model to Host (default) and acceleration to KVM (Linux) in Settings
and save before the next start. Selecting Host alone with Auto no longer emits
host. Explicit KVM requires working KVM access and does not fall back to TCG.
If using software emulation, retain Auto or TCG and validate the guest with the
new effective CPU model. Running QEMU processes are unchanged. Shut down affected
guests before upgrading rather than carrying suspended CPU state across a model
change; use matching CPU and accelerator settings at both live-migration endpoints.
- The native wrapper now exits with an error for invalid
KV_PORTinstead of probing port 9080. Unset it to use 9080, or set an integer from 1 to 65535. The daemon already rejected invalid ports inv0.1.0, but now validates its port and key before loading configuration or autostarting any guests. - Integer fields in
vms.jsonno longer accept the integer prefix of fractions, exponent notation, or malformed numbers. Rejected fields retain their defaults; the remaining VM fields still load. Before starting the upgraded daemon, fix any hand-written or externally generated values: for example, write"memory_mb":1000, not"memory_mb":1e3, and"disk_bps_throttle":2500, not"disk_bps_throttle":2.5e3. Hangar's own integer serialization needs no conversion. Check resource and throttle settings before powering on guests, since a default may differ from the intended value.
Back up vms.json and networks.json under ~/.config/hangar/ (or the
HANGAR_CONFIG_HOME base) while the daemon is stopped, and keep the previous
binaries. Back up guest disks separately; configuration backups do not contain
guest data. The vms.json read limit is now 32 MiB rather than 10 MiB. Before
rolling back to v0.1.0, stop guests and the daemon and check the inventory size:
that release cannot load files over 10 MiB. Preserve the newer configuration
before restoring a pre-upgrade backup; restoring it discards later configuration
changes. Review the CPU settings above before restarting guests on either version.
- Framebuffer polling no longer leaves the framebuffer lock held when no pixels are available, preventing subsequent polls and updates from deadlocking.
- The web UI shows VM uptime from daemon elapsed seconds, and restores the global tools, context-menu target, and search.
- Cloning a missing VM returns HTTP 404 instead of 409 with a full inventory.
vmrunhonors help and version in every argument position, keeps list records intact for names that contain braces, and rejects invalidKV_API_KEYvalues before connecting.- QMP clients disconnect after a failed read and after the async event cap.
- Unix socket I/O is bounded so a hung peer cannot stall the daemon.
- Re-opening a dialog during its close animation no longer hides the new prompt.
First tagged release: the Zig HTTP daemon, embedded web UI, vmrun CLI and
optional native WebView wrapper. Includes VM lifecycle and guest control,
snapshots, disk operations, virtual networks, live migration, browser consoles
and optional H.264 guest video. Requires Zig 0.16.0 and QEMU. The daemon defaults
to loopback-only access; a strong custom API key is required for remote access.
All optional. The daemon validates KV_API_KEY and KV_PORT before loading VM
state or autostarting guests; the desktop wrapper validates both before spawning
the daemon. vmrun validates KV_API_KEY before connecting. An empty value is
invalid for either variable.
| Variable | Default | Effect |
|---|---|---|
KV_API_KEY |
built-in hangar (loopback-only) |
X-API-Key secret. Setting a non-default key also binds all interfaces (::). Unset or hangar keeps the daemon loopback-only so the weak default is never reachable off-host. 1–64 printable-ASCII bytes, excluding spaces; invalid values abort startup. In exposed mode, data-bearing API reads require the key. |
KV_PORT |
9080 |
TCP listen port (non-zero u16). |
HANGAR_CONFIG_HOME |
$HOME |
Base dir for ~/.config/hangar/* state. |
Never commit a real KV_API_KEY. For any non-local deployment set a strong key
and front the daemon with TLS.
src/: Zig daemon, CLI, and web assets (seesrc/AGENTS.mdfor the module map).src/web/is the embedded vanilla-JS UI.docs/: design notes (DESIGN.md,VIDEO-PIPELINE.md, gap analysis, CUJs).tests/: standalone integration/e2e suites (the in-module unit/fuzz tests live at the bottom of each.zig).
State lives in ~/.config/hangar/ (vms.json, networks.json); only
configuration is persisted, never runtime status.
docs/DESIGN.md: architecture, HTTP API, keyboard shortcuts.docs/GAP-ANALYSIS.md: feature parity against VMware Workstation 17.docs/VIDEO-PIPELINE.md: the encoded guest-video path.docs/TEST-COVERAGE.md: what each suite covers and how to run it.AGENTS.md: build constraints and code conventions.
