Wails v3 Beta Unveiled: Multi‑Window Support, AST‑Based Bindings, and a Transparent Build System
Wails v3 Beta, released after three years of development, introduces an explicit application lifecycle API, native multi‑window capabilities, static‑analysis‑driven Go‑to‑TypeScript bindings, a readable Taskfile build system, experimental iOS/Android support, and a detailed migration path from v2, all illustrated with step‑by‑step code examples.
What is Wails?
Wails enables Go developers to build cross‑platform desktop applications using familiar web front‑end technologies (HTML, CSS, JavaScript, and frameworks such as Vue, React, Svelte) while keeping the back‑end logic in Go. It uses the operating system’s native WebView (WKWebView on macOS, WebView2 on Windows, WebKitGTK on Linux) instead of bundling Chromium, resulting in smaller binaries and faster startup.
Why a v3 rewrite?
Lea Anthony’s 2023 roadmap identified three pain points in v2:
Declarative application API : v2 exposed only wails.Run(), hiding the main window handle and forcing developers to use a separate Runtime API that required passing a context.Context. This made multi‑window development difficult.
Binding generation : v2 generated bindings by compiling a binary and then reflecting on it, creating a chicken‑and‑egg problem where neither the binary nor the bindings could be produced without the other.
Black‑box build system : The wails build command performed many hidden steps (compiling Go, generating bindings, installing front‑end dependencies, packaging, etc.), making customization and debugging nearly impossible.
v3 Beta – Five core changes
1. Explicit application lifecycle API
Instead of the monolithic wails.Run(...), developers now create an application instance, register services, and create windows explicitly. This object‑oriented model improves testability and native multi‑window support.
2. Native multi‑window support
Windows are first‑class objects with independent lifecycles, allowing editors, inspectors, settings panels, and other auxiliary windows without workarounds.
3. Service‑based Go bindings generated via static analysis
Business logic remains plain Go code, but it is exposed as a Service . A static source‑code analyzer generates TypeScript bindings directly from the Go source, preserving comments and parameter names for richer APIs. Services can also bundle their own front‑end assets, paving the way for a future plugin ecosystem.
4. Transparent, extensible build system
The build process is driven by a Taskfile.yml (similar to a Makefile). Developers can run wails3 build for the default flow or edit the Taskfile to customize steps such as icon generation, compression, or packaging.
5. More robust cross‑platform baseline
Beta supports Windows (amd64/arm64), macOS (Intel/Apple Silicon), Linux (amd64/arm64) with GTK4 + WebKitGTK 6.0, and includes experimental iOS and Android builds (not covered by the desktop compatibility guarantee).
Development history – from “perfect‑ist” to daily release
The first Alpha tag appeared on 2023‑01‑18; the Beta arrived on 2026‑08‑02 after a three‑and‑a‑half‑year cycle. Early on the team pursued a “perfect‑ist” strategy, fixing every bug before release, which slowed progress. In December 2024 the team switched to a daily release model: changes merged on a given day are shipped the same day, shortening feedback loops and increasing transparency.
Getting started – a five‑minute walkthrough
Prerequisite: Go 1.25+.
Install the CLI and run the environment check:
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
wails3 setupInitialize a project (default vanilla + Vite template):
wails3 init -n myapp
cd myapp
wails3 devUse -t react , -t vue , -t svelte , -t vanilla-js , or -t react-js to select other front‑end templates. List all templates with wails3 init -l .
Project structure is created under myapp/ (tree omitted for brevity).
Run wails3 dev – Go code changes trigger a rebuild, while front‑end changes hot‑reload.
Example service:
package main
type GreetService struct{}
func (g *GreetService) Greet(name string) string {
return "Hello " + name + "!"
}Register the service in main.go and create a window with custom options (size, title, macOS translucency, etc.). The generated TypeScript binding can be used as:
import { GreetService } from "../bindings/changeme";
window.greet = async () => {
const name = document.getElementById("name").value;
if (!name) return;
try {
const result = await GreetService.Greet(name);
document.getElementById("result").innerText = result;
} catch (err) {
console.error(err);
}
};Multi‑window demo
Add a second window in main.go and bind a close event:
package main
import (
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
)
func main() {
app := application.New(application.Options{Name: "MultiWindowDemo"})
mainWindow := app.Window.NewWithOptions(application.WebviewWindowOptions{Title: "主窗口", URL: "/"})
mainWindow.OnWindowEvent(events.Common.WindowClosing, func(e *application.WindowEvent) { app.Quit() })
inspector := app.Window.NewWithOptions(application.WebviewWindowOptions{Title: "检查器", Width: 480, Height: 640, URL: "/inspector.html"})
_ = inspector
app.Run()
}Each window has an independent lifecycle, demonstrating the core v3 improvement.
Packaging
Run wails3 build to produce optimized Go binaries and compressed front‑end assets. The output lands in the bin/ directory. Custom packaging steps can be edited directly in Taskfile.yml.
Migrating from v2 to v3
Migration is a true porting effort, not a simple import path change. Key conceptual changes:
New application and window lifecycle model.
Services replace the old Context‑bound bindings.
Direct application/window APIs replace the v2 Runtime package.
Front‑end bindings must be regenerated.
The official v2‑to‑v3 migration guide provides a feature‑by‑feature comparison and a test checklist. An experimental migration‑assistant tool is under evaluation but not yet part of the Beta.
Conclusion
Wails v3 Beta’s explicit object model, native multi‑window support, static‑analysis bindings, and transparent build system directly address the most‑criticized shortcomings of v2. While the desktop API is stable and already used in production, thorough testing is recommended before a full migration. v2 remains the stable release and will continue receiving fixes.
Reference links
https://v3.wails.io/blog/wails-v3-beta/ https://v3.wails.io/blog/2024-12-03-alpha10-and-new-release-strategy/ https://v3.wails.io/blog/the-road-to-wails-v3/ https://v3.wails.io/ https://v3.wails.io/migration/v2-to-v3/ https://github.com/wailsapp/wailsSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
TonyBai
Tony Bai's tech world (tonybai.com). Not satisfied with just "knowing how", we strive for mastery. Focused on Go language internals, high-quality engineering practices, and cloud‑native architecture, exploring cutting‑edge intersections of Go and AI. Gophers who pursue technology are welcome—follow me and evolve with Go.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
