Desktop (Wails)

Building & Distribution

Compile your desktop app into a native executable and distribute it to users.

Compile

Build a production-ready native executable with a single command:

terminal
$ grit compile

This auto-detects your desktop project and runs wails build. The output binary is placed in build/bin/.

You can also run wails build directly for more control over build flags.

Build Output

PlatformOutput
Windowsbuild/bin/myapp.exe
macOSbuild/bin/myapp.app
Linuxbuild/bin/myapp

Cross-Platform Builds

Build for a specific platform using the -platform flag:

terminal
# Windows
$ wails build -platform windows/amd64
# macOS (Intel)
$ wails build -platform darwin/amd64
# macOS (Apple Silicon)
$ wails build -platform darwin/arm64
# Linux
$ wails build -platform linux/amd64

Windows Installer (NSIS)

Create a Windows installer with NSIS (requires NSIS installed):

terminal
$ wails build -nsis

This produces a .exe installer that handles installation, Start Menu shortcuts, and uninstallation.

Production Tips

App Icon

Place your icon at build/appicon.png (1024x1024). Wails automatically converts it for each platform during build.

Environment Config

The .env file is read at runtime from the working directory. For production, either bundle it alongside the executable or use OS environment variables.

Embedded Assets

The React frontend is embedded into the Go binary via //go:embed all:frontend/dist. No separate files need to be distributed — everything is in one executable.

Database Location

SQLite creates app.db in the working directory. For a better user experience, consider using os.UserConfigDir() to store the database in the user's config folder.

Wails Configuration

The wails.json file controls build settings:

{
"name": "myapp",
"outputfilename": "myapp",
"frontend:install": "npm install",
"frontend:build": "npm run build",
"frontend:dev:watcher": "npm run dev",
"frontend:dev:serverUrl": "auto",
"author": {
"name": "Your Name"
}
}