Go + HTMX Template
This is built from the template https://github.com/Piszmog/go-htmx-template that comes with everything you need to build a Web Application using Go (templ) and HTMX.
The template comes with a basic structure of using a SQL DB (sqlc
), E2E testing (playwright), and styling (tailwindcss).
Getting Started
Clone https://github.com/Piszmog/go-htmx-template
Once cloned, run the update_module.sh
script to change the module to your module name.
./update_module my-new-module
Technologies
A few different technologies are configured to help getting off the ground easier.
- sqlc for database layer
- Stubbed to use SQLite
- This can be easily swapped with sqlx
- The script
upgrade_sqlc.sh
is available to upgrade GitHub Workflow files to latest sqlc version
- Tailwind CSS for styling
- Output is generated with the CLI
- templ for creating HTML
- The script
upgrade_templ.sh
is available to make upgrading easier
- The script
- HTMX for HTML interaction
- The script
upgrade_htmx.sh
is available to make upgrading easier
- The script
- goose for DB migrations
DB
This is the directory that sqlc
generates to. Update queries.sql
to build
your database operations.
Once queries.sql
is updated, run make generate-sql
to update the generated models
DB Migrations
This project now uses goose for DB migrations.
Install via brew install goose
on a mac, or install via golang with command go install github.com/pressly/goose/v3/cmd/goose@latest
Create a new up/down migration file with this command
goose -dir db/migrations sqlite3 ./db.sqlite3 create init sql