gofred

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 13 Imported by: 0

README

gofred

CI Go Reference

Build responsive web applications in Go with WebAssembly.

gofred lets you write UI in pure Go and run it in the browser via WebAssembly, with a small set of primitives for layout, components, routing, and events.


Table of contents

  • Features
  • Requirements
  • Install
  • Quick start
  • Minimal example
  • Project structure
  • Development
  • Browser support
  • Website
  • Contributing
  • License

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.
  • Batteries included: Dev server for local development.

Requirements

  • Go 1.25 or newer (as defined in go.mod)
  • A modern browser with WebAssembly support (all evergreen browsers)

Install

go get github.com/gofred-io/gofred

This repository is intended to be used as a library. The included server/ and main.go demonstrate a minimal runnable example.


Quick start (example app in this repo)

  1. Build the WebAssembly binary:
make build

This produces server/main.wasm.

  1. Start the dev server:
make serve

Then open the printed local URL (defaults to http://localhost:8080). The server/index.html bootstraps wasm_exec.js and loads main.wasm.


Minimal example

Create your own main.go and use gofred widgets to build UI. For example:

package main

import (
	"github.com/gofred-io/gofred/application"
    "github.com/gofred-io/gofred/foundation/text"
)

func main() {
    // See this repository's `main.go` for a complete runnable example
    application.Run(text.New("Hello, gofred!"))
}

Explore the foundation/ packages for available widgets and options.


Project structure (high level)

  • basic/ – Low-level HTML-like elements (e.g. div, span, img, svg).
  • foundation/ – Higher-level components (layout, text, buttons, router, etc.).
  • hooks/ – React-like hooks for navigation, breakpoint, and state management.
  • widget/ – Core widget abstractions and lifecycle.
  • server/ – Minimal static server and HTML bootstrap for wasm.

Development

  • Build wasm: make build
  • Run dev server: make serve

The CI workflow runs basic build and vet steps.


Browser support

Any modern browser with WebAssembly support. If you need older browser support, consider a fallback or a progressive enhancement approach.


Contributing

Issues and pull requests are welcome. Please read CONTRIBUTING.md first.


Website

For the official website source and additional docs/material, see the gofred website repository: https://github.com/gofred-io/gofred-website.

The website's README is available at: https://github.com/gofred-io/gofred-website/blob/master/README.md.


License

MIT — see LICENSE for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL