Build And Deploy

Native Desktop

Run and build a GoLazy app through a native desktop helper.

By Guillermo Alvarez - Published - Updated

Open a native development window

Run from the application module:

lazy native

lazy native starts the normal GoLazy development loop on a loopback address and opens that address in a native desktop window. The development server still owns rebuilds, JavaScript generation for apps with js.toml, app restarts, and browser reload injection.

Use the same app command overrides as lazy:

lazy native --cmdpath cmd/app
lazy native --cmdpath . --viewpath views

Optional window flags are available for the helper:

lazy native --title "My App" --width 1200 --height 800

Build a native desktop artifact

Build for the current platform:

lazy native build

The command resolves the GoLazy app command, builds it as a normal server binary in a temporary directory, and passes that binary to the native helper. Artifacts are written under:

dist/native/<goos-goarch>

Use --out to choose another output directory:

lazy native build --out dist/desktop

--target may name the current host platform, for example linux on Linux or macos on macOS. Cross-compilation is not part of the first native build slice.

Understand the helper cache

The normal lazy binary stays pure Go. Native webview and packaging behavior lives in:

github.com/golazy/native

lazy native checks the latest helper commit, builds the helper once, and caches it under the user cache by commit. Later runs reuse the cached helper. If the latest helper commit cannot be checked but a cached helper exists, GoLazy uses the cached helper so offline development can still work.

For development, the helper's default mode opens a native window. lazy native passes the working directory with --dir, the loopback address with --addr, environment values with --env, and the app command after --.

Prepare generated assets

For apps with js.toml, lazy native build runs the JavaScript pipeline before building the server binary. Tailwind remains explicit:

lazy tailwind
lazy native build

Run lazy tailwind first when Tailwind input files, package files, CSS dependencies, or generated stylesheet output changed.

Know the first scope

The first native desktop scope is current-platform macOS and Linux. Windows, Android, iOS, cross-compilation, signing, notarization, and installer formats belong to later native-helper work.