Documentation menu

Documentation › Run Galley

Desktop app

The native shell around the same server and web UI — how it starts and stops, what it adds over a browser tab, how to build it, and what hasn't been done or verified yet.

This page is for developers building or evaluating the desktop app. It is a thin native shell — Tauri 2, Rust, the system webview (WebKit on macOS), no bundled Chromium — around the same server and web UI the CLI runs. It starts the server privately on 127.0.0.1, shows the UI in a native window, and stops everything when you quit. The source and its full account are in apps/desktop/ and its README.

Status. Built and tested on macOS. There are no published downloads, and the installers are unsigned: macOS needs right-click → Open the first time; Windows SmartScreen will warn. Windows and Linux compile paths exist but have not been built or run. There is no auto-update. The OS keychain is not used for keys yet — they are kept in the Galley home like the CLI's.

Link to this section: What it adds over a browser tab

  • A folder picker for opening a site (the browser can only browse the server's folder list).
  • Reveal in Finder for a site's folder, and links that open in your default browser.
  • A native menu, one instance at a time, and the window's size and position remembered.
  • A start-up check: an app opened from the Finder gets a minimal PATH, so the shell reads your login shell's PATH and adds the usual install folders (Homebrew, nvm, Volta, fnm, asdf, mise, pnpm…). If git or node still can't be found, the start-up window says which, what it is for and where to get it, with Check again and Continue without them.
  • No terminal, and nothing left running when the window closes.

It shares the Galley home with the CLI (~/.galley, or GALLEY_HOME from the environment it was started in), so both see the same sites and settings.

Link to this section: How it runs the server

  1. It picks a free loopback port (the last one used, when still free, so the UI keeps its origin and browser storage between launches) and a fresh 256-bit token.
  2. It starts the server as galley desktop --exit-with-parent --port <port> with GALLEY_DESKTOP=1, GALLEY_HOST=127.0.0.1, GALLEY_PORT and GALLEY_TOKEN set, in its own process group.
  3. When GET /api/meta answers with desktop: true, the main window opens on http://127.0.0.1:<port>/?token=…, and the server swaps the token for a cookie. If the server exits early or doesn't answer within 30 seconds, the window shows Couldn't start with the last 40 lines of output under Technical details.

galley desktop is a command of the CLI made for this (Command line): loopback only, exactly the port given, and with --exit-with-parent it stops when its standard input closes — so if the shell crashes or is killed, the server and its dev servers go too.

Quitting — ⌘Q, closing the last window, logging out, a signal — sends SIGTERM to the server's process group, gives it 5 seconds to stop its previews, then SIGKILL, and kills any dev server that outlived it.

The packaged app ships its own Node.js runtime as the sidecar, with the single-file CLI bundle beside it. (A Bun-compiled binary was tried first and failed every request; the README records why.) The cost is size: Node is about 120 MB uncompressed.

Link to this section: Security

The UI is served from http://127.0.0.1:<port>, which Tauri treats as a remote origin with no IPC unless a capability names it. The main window's page may call exactly three commands — pick a folder, open an external link, reveal a site's folder — granted at run time for that port only, and each argument is checked in Rust (http/https links only; a folder only if it is the root of a site the server lists). Preview iframes on other ports can't call them. Navigation is locked to the app's origin; links that leave it open in your browser.

Link to this section: Build it

Prerequisites: Rust stable 1.90 or later and the platform's build tools (Xcode command-line tools on macOS), Node.js 20.11+ and pnpm 10. The Tauri CLI comes from the repository's dev dependencies.

sh
$ pnpm install
$ pnpm --filter @galley/web build
$ pnpm --filter @galley/desktop dev       # a debug build, running the CLI from source
$ pnpm --filter @galley/desktop bundle    # installers for this OS, in src-tauri/target/release/bundle/

A debug build runs the monorepo's CLI with your own Node, so changes to the server or engine need only a restart. If packages/cli/dist/galley.mjs exists, the CLI prefers it — a leftover bundle is what a debug build would run.

Link to this section: Tests

sh
$ pnpm --filter @galley/desktop test:rust       # unit tests: PATH, ports, tokens, process tree, argument checks
$ pnpm --filter @galley/desktop test:sidecar    # the end-to-end flow against the server runtime
$ pnpm --filter @galley/desktop test:shutdown   # launches the real app, quits it twice; macOS, needs a desktop session

None of these is part of pnpm test.

Link to this section: Not done yet

  • Auto-update.
  • Code signing and notarisation: wired into the release workflow, never exercised (no certificates).
  • Windows and Linux: written for, not built or run.
  • The OS keychain for secrets.

Link to this section: Next