Why Wails? ๐ค
Wails is a lightweight and fast alternative to Electron for building desktop applications with Go. Unlike Electron, which embeds a full browser engine (and eats RAM like there's no tomorrow ๐ฆ), Wails uses the WebView2, making it significantly more efficient. Here are some key features that make Wails stand out:
- Standard Go Backend โ Write your backend logic in Go, keeping it clean and efficient.
- Flexible Frontend โ Use any frontend framework youโre comfortable with, such as React, Vue, or Svelte.
- Pre-built Templates โ Quickly scaffold projects with ready-to-use templates.
- Seamless Go-JavaScript Communication โ Call Go methods directly from JavaScript.
- Auto-generated TypeScript Definitions โ Type safety for Go structs and methods.
- Native Look and Feel โ Support for native dialogs, menus, and dark/light mode. ๐
- Modern UI Effects โ Translucency and frosted glass effects. โจ
- Event-Driven System โ Unified eventing between Go and JavaScript.
- Cross-Platform โ Works on Windows, macOS, and Linux. ๐ฅ๏ธ
- Efficient Rendering โ Uses native rendering instead of an embedded browser.
My Experience with Wails v2 ๐ฎ
I built a game launcher for a multiplayer server using Wails v2. The application allows players to:
- Download game files ๐ฅ
- Manage mods ๐ง
- View in-game profiles and notifications ๐
- Check statistics (e.g., most active players, territory status) ๐
- Login, Register a new account and reset passwords ๐
- Enable Discord Rich Presence ๐ข
- Auto-install dependencies like Visual C++ Runtime and DirectX 9 ๐ ๏ธ
One of the coolest features I added was a self-updater. The launcher checks for the latest version, and if an update is available, a dialog prompts the user to update before proceeding. No more outdated versions floating around.
Development Challenges ๐
While Wails offers a fantastic experience, it does have some limitations. The biggest issue I encountered was the lack of support for cookies, which I needed for authentication and authorization. I managed to work around this by using global window variables, but I hope the WebView2 team at Microsoft adds support for it soon. ๐
Do I Recommend Wails? ๐ฏ
Absolutely. If youโre building a desktop app and want to avoid Electronโs resource-heavy approach (seriously, why does a simple app need 500MB of RAM? ๐คฏ) or donโt want to struggle with Rustโs complexity in Tauri, Wails is a perfect choice. The developer experience is top-notch, and the performance is impressive.
Wails proves that building desktop applications with Go doesnโt have to be complicated. It combines the power of Go with the flexibility of modern frontend technologies, making it an excellent tool for developers who want efficiency without sacrificing user experience.
If you havenโt tried Wails yet, give it a shotโyou wonโt regret it and your RAM will thank you! ๐ฅ๏ธ๐ฅ
Top comments (2)
Can you share some details about how to push updates for the App for already installed Wails applications? This is the only thing that makes me hesitant to use Wails otherwise I would prefer using it over Tauri
A competitor may soon emerge in the form of the GoGPU ecosystem github.com/gogpu . At least we've already started developing a native pure Go GUI library github.com/gogpu/ui...