Scaffolding

grit new-desktop walkthrough.

6 mineasy

Welcome to Building Desktop with Go API. Different kit, different command, different binary. This lesson covers the scaffold + what makes it different from the web/mobile kits.

The command — note it's different

Terminal
$grit new-desktop field-pos

Yes — new-desktop, not new --desktop. The desktop kit produces a standalone Wails app (Go + React bundled into one binary), not a monorepo. That's why it has its own command.

What you get

Desktop project shape

┌─────────────────────────────────────────────┐ │ field-pos/ (one Wails project) │ ├─────────────────────────────────────────────┤ │ │ │ main.go ◄─── entry point │ │ app.go ◄─── Go methods │ │ bound to React │ │ internal/ │ │ ├── db/ local SQLite │ │ ├── models/ GORM structs │ │ ├── service/ business logic │ │ └── ... │ │ │ │ frontend/ ◄─── React + Vite │ │ ├── src/ │ │ ├── package.json │ │ └── wailsjs/ auto-generated Go- │ │ to-TS bridge │ │ │ │ build/ Wails build assets │ │ wails.json Wails config │ │ go.mod │ └─────────────────────────────────────────────┘ wails build ──────────────► ┌─────────────────────────────────┐ │ field-pos.exe │ ◄── single binary, │ (frontend dist embedded) │ no server, └─────────────────────────────────┘ no internet.
One binary. The frontend is bundled INTO the Go executable at build time.

What ships

  • Wails v2 binding Go methods directly to React (no IPC plumbing)
  • SQLite + GORM for local storage — survives across launches
  • Frameless window with a custom titlebar (chapter 3 covers the polish)
  • Local auth with bcrypt — no server needed
  • In-app auto-updater — binary swap from GitHub releases (chapter 4)
  • NSIS installer templates (chapter 5)
  • Tailwind + shadcn/ui on the React side

Prerequisites

  • Go 1.21+ installed
  • Node 18+ and pnpm
  • Wails v2 CLI go install github.com/wailsapp/wails/v2/cmd/wails@latest
  • Windows: WebView2 (ships with Windows 11; older Windows installs it on first build)
  • macOS: Xcode CLI tools (xcode-select --install)
  • Linux: WebKit2GTK + libgtk-3-dev (Wails docs lists the apt commands)
Confirm Wails CLI is healthy with wails doctor — it checks every dependency and tells you exactly what's missing.

Quick check

A teammate asks why we use `grit new-desktop` and not `grit new --desktop`. What's the cleanest answer?

Try it

Scaffold + verify:

  1. Install Wails CLI: go install github.com/wailsapp/wails/v2/cmd/wails@latest
  2. Run wails doctor — fix anything red.
  3. grit new-desktop field-pos
  4. cd field-pos && ls — confirm main.go, frontend/, and wails.json are at the root (not under apps/).

Paste the directory listing in notes.md.

What's next

Next lesson — wails dev. Hot-reload loop for both Go AND React. Much faster than building every change.

Spot a typo? Have an idea?

Help us improve this lesson. One click opens a GitHub issue with the lesson URL pre-filled — suggest clearer wording, report a bug, or request more depth. The course keeps improving thanks to learners like you.

Suggest an improvement on GitHub