godashboard

command module
v0.0.0-...-8ed447c Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

README

Go dashboard

A dashboard application built in Go and gRPC using WebAssembly.

Using frontend framework such as Vecty or Ebiten, these type of application can be built with great productivity:

  • Admin dashboard
  • Multi-player online game

Features

  • Pure Go in both frontend and backend. No need to learn another frontend JavaScript framework.
  • Type-safe Web APIs defined in gRPC+Protobuf. Move away from REST+JSON.
  • Standalone executable with all the assets embedded for easy deployment.
  • Automatically frontend code rebuild on page reload.

Development

  • Run make generate to regenerate the protofiles and the frontend with all static resources embedded in bundle.go. For more information about embedding, check:
  • Run make serve to start the web server. In this case, the static resources embedding is not used. They are served from disk as usual.
    • Reload index.html could trigger a rebuild of main.wasm, just like wasmserve. Happy hacking!
  • Run go build (after running make generate) to get the standalone executable for release deployment.

Design

+----------------------+
|   Admin dashboard    |
+----------------------+
| frontend Golang code |
+----------+-----------+
|  golang  |  protobuf |
|  stdlib  |  message  |
|          |  objects  |
+----------+-----------+
|  browser Fetch API   |
+----------------------+
|        HTTP2         |
+----------------------+
| backend gRPC server  |
+----------------------+
|   Business System    |
+----------------------+

Limitations

  • To support gRPC-Web in the browser, an older grpc-go with a customized patch applied must be used. As the grpc-go and protobuf-go changed frequently, an older tool chain must be kept to build the project.

Dependencies

  • Golang 1.14+
  • The Google protobuf compiler, protoc.
  • $ GO111MODULE=on go get github.com/golang/protobuf/protoc-gen-go@v1.3.2 (do not use cmd/protoc-gen-go-grpc)
  • github.com/golang/protobuf (do not use google.golang.org/protobuf)
  • github.com/aclisp/grpc-go @branch add-grpc-web-client (forked from johanbrandhorst/grpc-go in case the upstream might be destroyed)
  • github.com/improbable-eng/grpc-web @v0.9.6 (this is the latest version work with grpc-go above, since which CloseNotifier is removed)

The Name

There are many so-called "godashboard" or "goadmin" projects, but no one is like this. The advantages are:

  • As a Gopher, developing everything from scratch in the full stack from frontend to backend is the motivation this project borns.
  • Thanks WebAssembly. Go developers can be competitive frontend developers, and you cann also share Go code between your frontend & backend.
  • Type-safe Web APIs will finally replace RESTful in the future.

Using godashboard as a beginning project

The branch beginning can be used as a start point to hacking. It contains a minimum WebAssembly-gRPC working demo.

References

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
tools

Jump to

Keyboard shortcuts

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