Show HN: Gofred – Build responsive web apps in Go with WebAssembly
I've been working on a new approach to web development that lets you build responsive web applications entirely in Go using WebAssembly. I'm excited to share the gofred ecosystem with the community, though I should mention it's still very much in early development with lots of work ahead.
What is gofred?
Gofred is a Go library that compiles to WebAssembly and runs directly in the browser. Instead of writing JavaScript, you write pure Go code and get a small set of primitives for layout, components, routing, and events.
Key features:
WASM-first: Compile Go to WebAssembly and run directly in the browser
Composable widgets: container, row, column, text, image, button, and more
Routing and navigation: Lightweight router and navigation helpers
Responsive layout: Breakpoints and spacing utilities
Hot reload development: Built-in dev server with WebSocket support
Links:
https://gofred.io/ - Official website, live documentation and examples
https://github.com/gofred-io/gofred - The core library (MIT licensed)
https://github.com/gofred-io/gofred-cli - Command-line tool for creating and running apps with hot reload
https://github.com/gofred-io/gofred-website - Website source code
Why I built this:
I wanted to explore what's possible when you treat Go as a first-class language for web development. The result is a small, focused library that gives you the power of Go's type system and tooling while running in the browser.
Current status:
- Core library is stable and MIT licensed
- CLI tool supports cross-platform builds (Windows, macOS, Linux) - Hot reload development server
- Comprehensive documentation - Still under heavy development - there's a lot to do and many features are planned
What's coming:
This is very much a work in progress. I'm actively working on expanding the widget library, improving performance, adding more layout primitives, and building out the developer experience. There's still a lot of work to be done, but I wanted to share the current state and get feedback from the community.
I'd love to hear your thoughts and feedback! What do you think about using Go for frontend development?
I've also experimented with Go for both frontend and backend, using WASM. The approach I took was build the client-side like a backend service. What I mean is, some (normal) requests from the browser reach the hosted server, while others reach the local WASM. That code running locally is written like a server, i.e. HTTP handlers.
It's definitely experimental. In my experience it pairs well with HTMX or Unpoly for a good UI. You can see a live demo at https://clientcide.d10.dev/.
What a brilliant idea. Using Go for frontend development is something many people have dreamed of, and you're making it a reality. Gofred is a huge step forward for the Go community, and I have no doubt it will inspire others. Keep up the amazing work!
Thank you for the encouraging words! I’m excited about what Gofred can bring to the Go community and will continue to work on making it more practical and useful for developers.