This project provides some working examples using Go and Hotwire Turbo.

Overview

hotwire-golang-website

This project provides some working examples using Go the hotwire/turbo library published by basecamp. This is based on a great post about Hotwire: HTML Over The Wire by @delitescere.

Overview

This service illustrates how to use turbo to enable updates to a website using primarily service side code.

  1. Uses html/template for views.
  2. Uses echo library to simplify routing.
  3. Uses a CDN to host all css / JS libraries base.html.
  4. Uses esbuild to automatically bundle JS assets on startup using echo-esbuild-middleware to serve them.

Hotwire Turbo

In this site I have implemented:

  1. Turbo Drive
  2. Turbo Frames
  3. Turbo Streams with Server Sent Events (SSE) and WebSockets
  4. stimulus

Most of the server side logic is in hotwire.go.

Prerequisites

  • Go 1.13 or later with support for Go Modules, used to build the service.
  • Node.js 12 or later, which is only used to install our asset building dependencies.

Running

To get this project running you need to setup some certificates, in my case I use https://github.com/FiloSottile/mkcert and there is a target in the makefile.

make certs

To start the service just run.

make start

For development you can use the following command, this will check for code updates and restart the service.

make watch

The service should be listening on https://hotwire.localhost:9443/

License

This application is released under Apache 2.0 license and is copyright Mark Wolfe.

You might also like...
Go scripts for finding an API key / some keywords in repository
Go scripts for finding an API key / some keywords in repository

Git-Secret Go scripts for finding an API key / some keywords in repository Update V1.0 🚀 Added some API Key checker Screenshoot 📷 How to Install go

Just some random matchers
Just some random matchers

The package provides a matcher interface to match a given value of any types.

Generate some random data

fake-data-generator-api generate some random data installing and using

Checking if some websites of interest are online

Web site status checker Checking if some websites of interest are online. A little weekend project. Technologies used Go Gin Current sites supported G

Some utility functions for generic types in Go.

GOUF - Utility Functions for generic types Go team released Go 1.18 beta recently with support for Generics(a.k.a type parameters). This package provi

Extremely flexible golang deep comparison, extends the go testing package, tests HTTP APIs and provides tests suite
Extremely flexible golang deep comparison, extends the go testing package, tests HTTP APIs and provides tests suite

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al.
Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al.

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al. This library is external dependency-free. It only depends on the Go standard library.

Slice - provides generic Map, Reduce and Filter functions for Go.

slice slice is a simple Go package to provide generic versions of Map, Reduce and Filter on slices. I mainly wrote it as an exercise to get more famil

An API that provides a small but well-thought service converting Euro to US Dollar and vice-versa

Currency Converter ###Problem An API that provides a small but well-thought service converting Euro to US Dollar and vice-versa. That API should only

Comments
  • cannot load embed: malformed module path

    cannot load embed: malformed module path "embed": missing dot in first path element

    Hi!

    If I run make start then I get this error:

    ...
    go: finding golang.org/x/text v0.3.3
    go: finding github.com/rs/zerolog v1.20.0
    go: finding github.com/wolfeidau/echo-middleware v1.1.0
    build command-line-arguments: cannot load embed: malformed module path "embed": missing dot in first path element
    make: *** [start] Error 1
    

    Any idea why this fails?

    opened by Gys 3
  • npm install

    npm install

    Are we supposed to CD into the /assets dir and run npm install?

    I'm getting this error:

    FTL failed to build assets errors=[{"Detail":null,"Location":{"Column":27,"File":"assets/src/controllers/clipboard_controller.ts","Length":16,"Line":1,"LineText":"import { Controller } from '@stimulus/core'","Namespace":""},"Text":"Could not resolve \"@stimulus/core\" (mark it as external to exclude it from the bundle)"},{"Detail":null,"Location":{"Column":28,"File":"assets/src/index.ts","Length":16,"Line":1,"LineText":"import { Application } from \"@stimulus/core\"","Namespace":""},"Text":"Could not resolve \"@stimulus/core\" (mark it as external to exclude it from the bundle)"}]
    

    Thanks!

    opened by bliaxiong 1
Owner
Mark Wolfe
Mark Wolfe
Go 1.18 generics use cases and examples

Go 1.18 generics use cases What are generics? See Type Parameters Proposal. How to run the examples? As of today, gotip is the simplest way to run the

Vladimir Varankin 3 Jan 10, 2022
Concurrency in Go video course with in depth explanations & examples

Concurrency in Go Summary Coding Examples Introduction to Concurrency Go Routines Channels Select Concurrency Patterns Atomics Wait Groups - sync.Wait

Go Basics 210 Dec 26, 2022
CUE utilities and helpers for working with tree based objects in any combination of CUE, Yaml, and JSON.

Cuetils CUE utilities and helpers for working with tree based objects in any combination of CUE, Yaml, and JSON. Using As a command line binary The cu

_Hofstadter 65 Dec 24, 2022
Flock is a project which provides a Go solution for system level file locks for all platforms Golang supports.

Flock is a project which provides a Go solution for system level file locks for all platforms Golang supports.

Ken Sipe 0 Feb 8, 2022
tool for working with numbers and units

tool for working with numbers and units

null 36 Nov 26, 2022
Payload is a simple tool for working with production data in your local environment.

Payload Payload is a simple tool for working with production data in your local environment. What problem does it solve? You're working with Cloud SQL

Ivan Vanderbyl 1 Oct 13, 2021
Quicat -- a socat-like utility for working with QUIC

Quicat -- a socat-like utility for working with QUIC This is a utility that I occasionally use for building secure-enough tunnels on flaky connections

Pavel Khlebovich 0 Feb 6, 2022
Go-path - A helper package that provides utilities for parsing and using ipfs paths

go-path is a helper package that provides utilities for parsing and using ipfs paths

y 0 Jan 18, 2022
Yet another StructTag, with some features liked cache and alias.

Yet another StructTag, with some features liked cache and alias.

Ryan Liu 2 Nov 1, 2021
rxscan provides functionality to scan text to variables using regular expression capture group.

rxscan rxscan provides functionality to scan text to variables using regular expression capture group. This library is still experimental, use at your

Ahmy Yulrizka 14 Dec 21, 2020