Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 28, 2026·3 min de lecture

go-app — Build Progressive Web Apps with Go and WebAssembly

A Go package for building progressive web apps using a declarative component model, compiling Go code to WebAssembly so your entire application logic runs in the browser with native-like performance.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
go-app
Commande d'installation directe
npx -y tokrepo@latest install 6460e985-8a61-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

go-app is a Go package that lets developers write frontend web applications entirely in Go. Your code compiles to WebAssembly and runs in the browser, while a thin Go HTTP server handles routing and asset delivery. The result is a progressive web app with offline support, installability, and the full type safety of Go.

What go-app Does

  • Compiles Go application code to WebAssembly for client-side execution
  • Provides a declarative, component-based UI model similar to React
  • Generates a service worker and manifest for PWA installability and offline caching
  • Handles server-side rendering and prerendering for SEO and fast initial loads
  • Manages routing, lifecycle events, and state updates within a single Go codebase

Architecture Overview

go-app works in two modes simultaneously. On the server side, a Go HTTP handler serves the compiled WASM binary, static assets, and an auto-generated HTML shell. On the client side, the WASM binary bootstraps the component tree, mounts it to the DOM, and handles all user interaction. Components follow a lifecycle pattern with OnMount, OnNav, and Render methods. The framework manages a virtual DOM diffing layer that updates only the changed elements.

Self-Hosting & Configuration

  • Add go-app to your module with go get github.com/maxence-charriere/go-app/v10
  • Build the client WASM binary with GOARCH=wasm GOOS=js go build -o web/app.wasm
  • Serve assets via the built-in app.Handler in any Go HTTP server
  • Configure the PWA manifest (name, icons, theme color) through app.Handler fields
  • Deploy as a single binary plus the WASM file to any hosting provider

Key Features

  • Write frontend and backend in the same language with shared types and logic
  • Automatic PWA features including service worker generation and offline caching
  • SEO-friendly with server-side and prerendering support out of the box
  • No JavaScript, TypeScript, or Node.js tooling required in the build pipeline
  • Component-based architecture with lifecycle hooks and event handling

Comparison with Similar Tools

  • Wails compiles Go for native desktop apps; go-app targets the browser via WebAssembly
  • Vecty is another Go-to-WASM framework but lacks built-in PWA and SSR support
  • Lorca uses Chrome as a UI shell; go-app runs entirely in the browser without requiring Chrome
  • React/Next.js requires JavaScript and Node.js; go-app keeps everything in Go
  • Fyne builds native desktop UIs with Go; go-app delivers web UIs through the browser

FAQ

Q: How large is the resulting WASM binary? A: A minimal go-app binary starts around 5-8 MB. Using TinyGo or wasm-opt can reduce this. Gzip compression brings the transfer size to roughly 1-2 MB.

Q: Can I use existing JavaScript libraries? A: Yes. go-app provides js.Value interop to call JavaScript functions and access browser APIs from Go code.

Q: Does go-app support hot reloading during development? A: Not natively, but you can use tools like air or entr to watch for file changes and rebuild the WASM binary automatically.

Q: Is go-app suitable for large applications? A: go-app scales well for medium-complexity apps. For very large SPAs, the WASM binary size and Go's garbage collector pauses in WASM are factors to evaluate.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires