Skip to content

cookiengineer/gooey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

253 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gooey

Gooey (pronounced as /'ɡu.i/ or GUI) is divided in three parts:

  • A pure Go WebASM bindings framework that bridges the gaps between Go, WebASM and Browser APIs.
  • A pure Go Web UI components framework that structures a Web Application, ready for use in local Web Views.
  • A pure CSS theme design optimized for accessibility, readability, and light/dark mode support.

Motivation

Problems in 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).
  • 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 for Gooey

  • 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.

Reactive MVC Architecture

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 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 documents the architecture of a Gooey App.
  • BINDINGS.md documents the state of implemented Web Bindings.
  • COMPONENTS.md documents the state of implemented Web Components.
  • TODO.md documents the work-in-progress of things that will be implemented in the near future.

The lint.sh script shows a list of syntax errors, missing build tags and missing files that need to be implemented. That list is a good starting point for contributions.

Examples

The examples folder contains minimal demos that show how to use the gooey bindings and components. Each example consists of the following files:

  • The build.sh builds and serves the example on http://localhost:3000.
  • The main.go is compiled into a main.wasm.
  • The serve.go is the necessary local webserver.

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

Components Examples

Changelog

Changes, Additions and Removals are documented in CHANGELOG.md.

License

This project is licensed under the MIT license.

Contributors

About

😈 💥 🔫 Opinionated Go WebASM framework

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors