Skip to content

A web application example showing the use of WebComponents with Go as small executable server.

License

Notifications You must be signed in to change notification settings

larmic/webcomponents-with-go-example

Repository files navigation

webcomponents-with-go-example

License Docker build and push Docker Image Version (latest by date)

A web application example showing the use of WebComponents with Go as small executable server.

Goals

  • an artifact as small as possible that provides a UI (less than 10 MB)
  • use as few UI frameworks as possible
  • as few configuration files as possible
  • fast build times
  • multi-platform support (arm and amd64)

Used technologies

Server

Go >= 1.16 supports embedding files to executable. So it is possible to create very small executables that contain all needed assets.

Frontend

npm as dependency management tool.

Build tool ParcelJS places great emphasis on convention over configuration. Here, the goal of having to configure as little as possible is supported.

lit-html is a small Javascript library, which allows to create components in a simple way (based on WebComponents). This gives you a React feeling.

Build tools

Makefile to build and run application and docker images on your local machine.

Dockerfile to build docker image.

Github Actions to build (and push) docker image on each commit.

Build and run it on your local machine

run frontend in development mode (for debugging etc...)

This command starts a backend mock server (see src/mock/backend-mock.go) and allows using the full parcel development support.

$ make frontend-run

build application without docker

This command builds an executable for your platform.

$ make frontend-build
$ make backend-build
$ ./bin/server

Open localhost:8080 in your browser.

build application with docker

This command build a docker image for your platform.

$ make docker-build
$ make docker-run

Open localhost:8080 in your browser.

Multi-platform support

For multi-platform support see github actions.

Demos

See docker-compose demo and kubernetes demo.