DEV Community

Alex Spinov
Alex Spinov

Posted on

Wails Has a Free Go Framework for Desktop Apps — Electron Without the Bloat

Go developers: you don't need Electron. Wails gives you desktop apps with Go backend + web frontend, no Chromium bundled.

What is Wails?

Wails is a framework for building desktop applications using Go and web technologies. Like Tauri but with Go instead of Rust, it uses the system's native webview for tiny bundles.

Why Go Developers Love Wails

1. Go Backend, Web Frontend

// app.go
package main

import "context"

type App struct {
    ctx context.Context
}

func NewApp() *App {
    return &App{}
}

func (a *App) Startup(ctx context.Context) {
    a.ctx = ctx
}

func (a *App) FetchData(url string) (string, error) {
    resp, err := http.Get(url)
    if err != nil {
        return "", err
    }
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    return string(body), nil
}

func (a *App) ReadFile(path string) (string, error) {
    data, err := os.ReadFile(path)
    return string(data), err
}
Enter fullscreen mode Exit fullscreen mode
// Frontend — call Go functions directly
import { FetchData, ReadFile } from '../wailsjs/go/main/App';

const data = await FetchData('https://api.example.com/data');
const content = await ReadFile('/path/to/file.txt');
Enter fullscreen mode Exit fullscreen mode

2. Auto-Generated TypeScript Bindings

Every Go method you write automatically gets TypeScript bindings. Full type safety across the Go/JS boundary.

type User struct {
    Name  string `json:"name"`
    Email string `json:"email"`
    Age   int    `json:"age"`
}

func (a *App) GetUser(id int) (*User, error) {
    return db.FindUser(id)
}
Enter fullscreen mode Exit fullscreen mode
// Auto-generated — you don't write this
import { GetUser } from '../wailsjs/go/main/App';
const user = await GetUser(42);
// user is typed as { name: string, email: string, age: number }
Enter fullscreen mode Exit fullscreen mode

3. Any Frontend Framework

wails init -n myapp -t react-ts
wails init -n myapp -t svelte-ts
wails init -n myapp -t vue-ts
wails init -n myapp -t vanilla
Enter fullscreen mode Exit fullscreen mode

4. Live Development

wails dev
# Hot-reload for frontend
# Auto-rebuild for Go backend
# Browser DevTools available
Enter fullscreen mode Exit fullscreen mode

5. Tiny Bundles

wails build
# macOS: ~8MB .app
# Windows: ~10MB .exe
# Linux: ~8MB binary
Enter fullscreen mode Exit fullscreen mode

Wails vs Electron vs Tauri

Wails Electron Tauri
Backend Go Node.js Rust
Bundle size 8-15MB 180-250MB 3-30MB
Memory 50-100MB 200-500MB 50-100MB
Learning curve Low (Go devs) Low Medium (Rust)
Mobile No No Yes (v2)
Maturity v2 stable Very mature v2 stable

Getting Started

# Install
go install github.com/wailsapp/wails/v2/cmd/wails@latest

# Create app
wails init -n myapp -t react-ts

# Dev
cd myapp && wails dev

# Build
wails build
Enter fullscreen mode Exit fullscreen mode

The Bottom Line

Wails is the fastest path from Go developer to desktop app developer. If you already know Go, you can build a production desktop app in a weekend.


Need data extraction tools? Check my Apify actors or email spinov001@gmail.com.

Top comments (0)