This is an experiment on how to create a minimal desktop application using only the Go language.
- 🪟 Native window through webview, pointed at a local server
- 📦 Embedded WASM:
main.goembeds the WebAssembly build (//go:embed) and serves it on a random free port - 🔌 Websocket bridge: the UI (Go compiled to WASM) and the app talk through JSON messages
- 🧱 Typed protocol: the
bridgepackage defines the request/response types on both sides
goita/
├── main.go # desktop app: embeds the WASM, starts the server, opens the webview
├── bridge/ # shared JSON message types (Request / Response) and Process()
├── wasm/ # UI code compiled to WebAssembly (honnef.co/go/js/dom/v2)
└── storage/ # generated main.wasm + wasm_exec.js land here
A message from the UI and its answer:
{ "kind": "GetOsDetails", "data": {} }{ "kind": "GetOsDetails", "data": { "Arch": "amd64", "Os": "linux" } }Response values depend on your machine. The other supported message is GetUserName.
- 🐹 Go 1.16 or newer
- 🖥️ The system webview libraries required by webview. On Linux the pinned module links with
pkg-configpackagesgtk+-3.0andwebkit2gtk-4.0.
From the repository root, generate the WebAssembly assets:
go generate wasm/main.goThat copies wasm_exec.js into storage/ from $GOROOT/lib/wasm (Go 1.24 and newer) or $GOROOT/misc/wasm (older Go), then builds storage/main.wasm.
Run the desktop app:
go run main.goA webview window will appear, and there you can start querying for the system platform or the username that started the application.
- 🦀 rusty: the same idea in pure Rust (wry + WASM)
Made by Marc Garcia · marcgarcia.dev · @marc_garcia on X · GitHub