mygo README

The project's README from github.com/egoist/mygo. As one markdown file: README.md.

MyGo

Desktop apps in Go, with a web frontend or a native UI.

Each MyGo window shows one of two kinds of interface, and one app can mix them:

Either way, an app is a single Go binary of a few megabytes, focused on low memory and CPU use.

A window with a web page, whose frontend calls Go:

type Greeter struct{}

// Greet returns a greeting.
func (Greeter) Greet(name string) string { return "Hello, " + name }

func main() {
	mygo.Bind(Greeter{})
	mygo.App.WhenReady(func() {
		mygo.NewWindow(mygo.WindowOptions{Title: "Hello", URL: "/"})
	})
	if err := mygo.App.Run(); err != nil {
		log.Fatal(err)
	}
}
import { Greeter } from "./mygo"; // generated

document.body.textContent = await Greeter.greet("Ada");

A window with native UI, whose view is a Go function of the app's state:

type counter struct{ n int }

func (s *counter) view(c *ui.Context) {
	ui.Column(c).Fill().Center().Gap(12).Children(func() {
		ui.Text(c, fmt.Sprint(s.n)).FontSize(40).Bold()
		if ui.PrimaryButton(c, "Increment").Clicked() {
			s.n++
		}
	})
}

func main() {
	s := &counter{}
	mygo.App.WhenReady(func() {
		mygo.NewWindow(mygo.WindowOptions{
			Title:   "Counter",
			Content: ui.View(s.view),
		})
	})
	if err := mygo.App.Run(); err != nil {
		log.Fatal(err)
	}
}

Getting started

With Go 1.27+ and Bun, create an app with a web frontend:

bunx mygo-cli init my-app      # or: npx mygo-cli init my-app
cd my-app
bun run dev

An app of native UI needs Go alone:

go run github.com/egoist/mygo/cmd/mygo@latest init -template native my-app
cd my-app
go tool mygo dev

Read the documentation.

License

MIT

mygo (egoist/mygo)

framework
Searching Database…

2.2K ·GitHub
What is this?MyGo is a Go toolkit for building desktop apps that either embed a web frontend in the OS's native webview or render a fully native UI drawn by MyGo itself on the GPU, and you can mix both in one app.
Is this a webview wrapper or a real native UI toolkit?Both: a window can be a web page running in the OS webview (WKWebView, WebKitGTK, or WebView2) that calls Go code via a generated TypeScript client, or it can be pure native UI written only in Go using the 'ui' package, with no HTML, JS, or webview at all.
How do I create a new app?For a web-frontend app you use Go together with Bun to scaffold the project; for a pure native UI app you only need Go, no JS tooling at all.
What do I need installed before building an app with a web frontend?You need Go 1.27 or newer plus Bun; native-UI-only apps need just Go, since there is no cgo dependency and the OS's built-in webview is used for web pages.
Do I need cgo or a platform-specific toolchain to cross-build?No, MyGo is pure Go with no cgo, so you can build binaries for macOS, Windows, and Linux from a single machine without native toolchains.
Which operating systems can I ship apps to?macOS, Linux, and Windows; web-frontend windows use each OS's own webview (WKWebView, WebKitGTK, WebView2) and MyGo can also produce app bundles, disk images, Windows installers, and Debian packages.
What does the native UI toolkit include out of the box?Flexbox and grid layout, widgets, text editing with input methods, virtualized lists, SVG icons, animations, screen reader support, and views you can test without opening a window.
Can it ship automatic updates for my app?Yes, MyGo supports signed auto-updates with delta updates and an update window similar to Sparkle, along with code signing and notarization for distribution.
How small and lightweight are MyGo apps?An app compiles to a single Go binary of a few megabytes, and because it's pure Go with no cgo and native UI skips the webview entirely, it stays focused on low memory and CPU use.
Can I mix a web page and a native UI window in the same app?Yes, each MyGo window is either a web page or native UI, and a single app can combine both kinds of windows.
Creator
egoist
Size
56.6 MB
Stars
2.2K
Age
21d
Commits · 90 Days