https://github.com/cookiengineer/gooey
:smiling_imp: :boom: :gun: Opinionated Go WebASM framework
https://github.com/cookiengineer/gooey
golang webassembly webframework
Last synced: 17 days ago
JSON representation
:smiling_imp: :boom: :gun: Opinionated Go WebASM framework
- Host: GitHub
- URL: https://github.com/cookiengineer/gooey
- Owner: cookiengineer
- License: mit
- Created: 2024-07-31T11:22:47.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2026-06-14T07:55:54.000Z (23 days ago)
- Last Synced: 2026-06-14T09:22:42.315Z (23 days ago)
- Topics: golang, webassembly, webframework
- Language: Go
- Homepage:
- Size: 3.07 MB
- Stars: 75
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Gooey
[Gooey](https://github.com/cookiengineer/gooey) (pronounced as `/'ɡu.i/` or `GUI`) is divided in three parts:
- A pure Go WebASM [bindings](/bindings) framework that bridges the gaps between Go, WebASM and Browser APIs.
- A pure Go Web UI [components](/components) framework that structures a Web Application, ready for use in local Web Views.
- A pure CSS [design](/design) theme optimized for accessibility, readability, and light/dark mode support.
## Motivation
**Problems in modern Web App development**:
- Web Components are great as a separation of feature concept.
- Web Components are bad for web accessibility (e.g. `aria-` property fatigue).
- Frontend-to-Backend communication is always a redundancy problem.
- Frontend schema safety and validation is always implemented in another language (e.g. `ECMAScript`, `TypeScript`, etc).
- Backend schema safety and validation is great with `Marshal` / `Unmarshal`.
- Bug-to-bug differences from Frontend and Backend eat up a lot of development time.
- Using online-first Web Apps with slow internet connections is painful.
**Conclusions**:
- Use Go's types, structs and schemas both on the Frontend and on the Backend side.
- Use dynamic Web Components for the Frontend.
- Use static Web Components for the Backend to provide server-side rendering.
- Build offline-first Web Apps with `webview/webview` pointing to a local web server.
- Bundle all assets in `/public` via `go:embed` within the application binary.
## Architecture
Gooey uses a Reactive MVC Architecture and embraces the use of a unidirectional
flow, meaning it is a circular pattern of state management.
This is a nice architecture pattern for deserialization and serialization of the
Schemas into Views, because all custom application code lands in the separated
controllers, which each manage their own View, Client, and Storage.

Custom Controllers with even Custom Views are easily integratable this way, because
the Reactive MVC Architecture allows to build an App where each of the Views is
just a Web Component layer and doesn't need to be touched for most cases.
## Documentation
- [ERRATA.md](/docs/ERRATA.md) documents the state of known errata and problems of using Go via WebASM.
**IMPORTANT**: Note that even if you have years of Go development experience, the Errata
document is still relevant for you, because it highlights problems when using Go in the
Web Browser and the quirks that come with it.
- [ARCHITECTURE.md](/docs/ARCHITECTURE.md) documents the architecture of a Gooey App.
- [BINDINGS.md](/docs/BINDINGS.md) documents the state of implemented Web Bindings.
- [COMPONENTS.md](/docs/COMPONENTS.md) documents the state of implemented Web Components.
- [TODO.md](/docs/TODO.md) documents the work-in-progress of things that will be implemented in the near future.
## Examples
The [examples](/examples) folder contains minimal demos that show how to use the gooey
bindings and components. They also contain a `main.go` that is compiled into a `main.wasm`
file and a `serve.go` that reflects the local webserver.
Each example contains a `build.sh` that builds and serves the demo on `http://localhost:3000`.
**Important**: The examples also serve as unit tests, because `go test` cannot generate
binaries for the `syscall/js` platform right now. As soon as unit tests are available
upstream via `go test -c`, the plan is to migrate towards fully integrated unit tests.
**Bindings Examples**:
- [canvas2d](/examples/bindings/canvas2d)
- [console](/examples/bindings/console)
- [crypto-aescbc](/examples/bindings/crypto-aescbc)
- [cookiestore](/examples/bindings/cookiestore)
- [dom](/examples/bindings/dom)
- [encoding](/examples/bindings/encoding)
- [fetch](/examples/bindings/fetch)
- [history](/examples/bindings/history)
- [location](/examples/bindings/location)
- [navigator](/examples/bindings/navigator)
- [navigator-geolocation](/examples/bindings/navigator-geolocation)
- [storages](/examples/bindings/storages)
**Components Examples**:
- [app](/examples/components/app)
- [app-components](/examples/components/app-components)
- [app-views](/examples/components/app-views)
- [content-fieldset](/examples/components/content-fieldset)
- [content-linechart](/examples/components/content-linechart)
- [content-piechart](/examples/components/content-piechart)
- [content-table](/examples/components/content-table)
- [layout](/examples/components/layout)
- [ui](/examples/components/ui)
# Changelog
Changes, Additions and Removals are documented in [CHANGELOG.md](./CHANGELOG.md).
# License
This project is licensed under the [MIT](./LICENSE.txt) license.
# Contributors
- [cookiengineer](https://github.com/cookiengineer)
- [utsavanand2](https://github.com/utsavanand2)