No description
Find a file
2023-09-04 16:36:37 +02:00
internal refactor routing, update readme 2023-09-04 13:29:40 +02:00
templates add makefile and tweak CSS 2023-09-04 16:29:16 +02:00
.air.toml initial commit 2023-09-03 02:12:43 +02:00
.gitginore replace redis with eventstore 2023-09-03 13:45:51 +02:00
.gitignore remove generated CSS file from git repo 2023-09-04 16:30:27 +02:00
go.mod refactor routing, update readme 2023-09-04 13:29:40 +02:00
go.sum remove redis requirement from go.mod 2023-09-04 09:57:33 +02:00
input.css initial commit 2023-09-03 02:12:43 +02:00
main.go refactor routing, update readme 2023-09-04 13:29:40 +02:00
Makefile add makefile and tweak CSS 2023-09-04 16:29:16 +02:00
README.md add docs for Makefile 2023-09-04 16:36:37 +02:00
tailwind.config.js initial commit 2023-09-03 02:12:43 +02:00

Todo App with GO and HTMX

Goal: make a todo app with minimal reliance on other libraries and frameworks.

I'll assume that it is a single user app so I do not have to worry about concurrent access, high throughput, etc..

Plan day 1

  • create Go webserver
  • create landing page
  • import HTMX code
  • display todo list
  • add tailwind CSS
  • show todo list
  • let todos be marked completed
  • remove todos
  • add new todo with form
  • persist todos in redis
  • spruce up

Plan day 2

make it use only battery included features

i.e. replace redis with an event driven approach

  • modularize app
  • replace redis with json stream
  • use hashmap for fast individual access
  • cache data to avoid reading each time
  • create event store
  • make events
  • implement event store

Usage tips

Running the app locally

Install air from cosmtrek/air github repo with go install github.com/cosmtrek/air@latest or use the provided install bash scripts. This tool will watch for changes in the project folder and rebuild and restart the app during development (at least most of the time)

then in the root folder

air

and check for errors. Normally the site will now answer on port 8080.

Updating CSS with tailwind

Just add tailwind tags to the class attributes per documentation

then in the root folder:

npx tailwindcss -i ./src/input.css -o ./static/output.css --watch

Same deal, it will monitor changes in the templates and regenerate the output.css on the fly.

Makefile

I added a makefile to not have to remember the command lines :

make tailwind

starts the CSS generator

and

make air 

starts the go watcher builder although I do not know why anyone wants to type the 5 extra chars.