This is a simple chat app which shows how to use Go with Hotwire.

chat-hotwire-go

This is a simple chat app which shows how to use Go with Hotwire.

demo

  • Messages from another user are received via Turbo Streams over a websocket connection.
  • A stimulus controller is used to clear the message form.
  • The application can work without JavaScript

Setup

You need to have go and npm installed.

Then run:

go get -u github.com/cosmtrek/air
git clone https://github.com/lu4p/chat-hotwire-go.git
cd chat-hotwire-go
npm install
npm run dev

After the above just run air, to start the webapp with hot reloading.

Note: The generated dist/main.css file is rather large now at ~6MB, but don't worry this is only because every possible class of tailwind is included (there are many), once you build for production only ~4KB of CSS is left.

If you want to also rebuild the JS and CSS on change run npm run watch in a separate terminal session.

To build for production run npm run prod and then go build.

This project uses:

  • html/template, a html templating library included in the stdlib of Go
  • Echo, a Go web framework
  • Hotwire a new approach from Basecamp for writing modern web applications without much JavaScript
  • tailwindcss, makes HTML look nice
  • webpack, for packing JS and CSS into single files, with minimization enabled, setup to extract CSS to a seperate file
  • Air, for hot reloading Go code and templates on change.
Similar Resources

Build for all Go-supported platforms by default, disable those which you don't want.

bagop Build for all Go-supported platforms by default, disable those which you don't want. Overview bagop is a simple build tool for Go which tries to

Jul 29, 2022

Geth client which picks the most profitable blocks to mine using a greedy algorithm

Greeden-Geth Greeden-Geth is a protocol-agnostic client which uses a greedy algorithm to pick the most profitable blocks to submit to the network out

Nov 16, 2022

A limited Flow Access API which runs outside of the Flow Network using the DPS

Access API Flow DPS implements the Flow Access API Specification, except for the following endpoints: SendTransaction GetLatestProtocolStateSnapshot G

Jul 28, 2022

A bin which will keep screen open by moving a mouse

Stay Awake This is a small program which will move mouse up and down to keep screen on. This stimulates like user is doing something. Motivation I had

Oct 21, 2021

PKSUID is a small extension for KSUID (K-Sortable Globally Unique IDs) which allows prefixing it with arbitrary up to 16 bytes strings

PKSUID is a small extension for KSUID (K-Sortable Globally Unique IDs) which allows prefixing it with arbitrary up to 16 bytes strings

Dec 1, 2022

Help to release a project which especially has multiple git repositories

This project aims to help to release a project which especially has multiple git repositories. Installation Install it to a Kubernetes cluster. You ca

Dec 15, 2022

Demo project which implements accumulative loyalty system

Gophermart Demo project which implements accumulative loyalty system POST /api/user/register — user registration; POST /api/user/login — user authenti

Mar 31, 2022

gevent imply go-event which tries to make event handling easier.

gevent imply go-event which tries to make event handling easier. What does gevent want to do Async execute jobs safely without too many go routines. S

Nov 10, 2021

QuickAbeHiroshi - The golang program to open a web site which is the fastest in the world

QuickAbeHiroshi - The golang program to open a web site which is the fastest in the world

The golang program to open a web site which is the fastest in the world.

Jan 2, 2022
Shows your recent browser history in tree style. 树状展示浏览器历史 (For Edge / Chromium / Chrome)
Shows your recent browser history in tree style. 树状展示浏览器历史  (For Edge / Chromium / Chrome)

Tree Style Histyle This extension shows your recent browser history in tree style. When you browser pages from internet, you always jump from one page

Jan 3, 2023
A helm plugin that shows a diff explaining what a helm upgrade would change
A helm plugin that shows a diff explaining what a helm upgrade would change

Helm Diff Plugin This is a Helm plugin giving your a preview of what a helm upgrade would change.

Jan 4, 2023
It is a basic todo app which has CRUD operation using Buffalo and golang

It is a basic todo app which has CRUD operation using Buffalo and golang

Nov 1, 2021
Implementation of the test task, chat in the goland language
Implementation of the test task, chat in the goland language

Implementation of the test task, chat in the goland language

Dec 5, 2021
A test repo to demonstrate the current (go1.17.2) issue when trying to use retractA test repo to demonstrate the current (go1.17.2) issue when trying to use retract

test-go-mod-retract This is a test repo to demonstrate the current (go1.17.2) issue when trying to use retract in go.mod to retract a version in a non

Oct 16, 2021
Person is a simple CRUD application written in go which exposes API endpoint to create the person.

Person Person is a simple CRUD application written in go which exposes API endpoint to create the person. Installation Install docker in your local sy

Oct 18, 2021
simple bank which is implemented using Golang

Banker The service that we’re going to build is a simple bank. It will provide APIs for the frontend to do following things: Create and manage bank ac

Nov 15, 2021
A dead simple Go wrapper around the hidden moonarch.app API.

moonarch A dead simple Go wrapper around the hidden moonarch.app API. How-To First, get the repository: go get github.com/lazdotdigital/moonarch. moon

Nov 27, 2021
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way to say thanks to the maintainers of the modules you use and the contributors of Go itself.
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way  to say thanks to the maintainers of the modules you use and the contributors of Go itself.

Give thanks (in the form of a GitHub ★) to your fellow Go modules maintainers. About GoThanks performs the following operations Sends a star to Go's r

Dec 24, 2022
A simple tool to send binary data over a serial port. Designed for use with my retro computer systems.

Colin's Transfer Tool This is a really basic tool to transfer firmware files to my retro computer systems over a serial port. This removes the need fo

Dec 21, 2021