This is my personal HTMX app.
This app uses HTMX, Templ, and Tailwind.
A .env file is required with the following:
# Must be a vaild hex string
COOKIE_SECRET_KEY=""
JWT_SECRET_KEY=""Follow their docs for installation steps: Docs
I prefer to use Tailwind's standalone CLI to run Tailwind, but other options are available. Docs for standalone CLI: Docs
There are many ways to install sqlite3; feel free to research for your environment.
Once you have SQLite installed, create a DB file called wonk.db. This file serves as the database for the application.
Once the wonk.db file is created, run the scripts in the folder sqlite/scripts/, once completed, the DB is ready to be used.
Below are commands to help:
# Create db file
sqlite3 wonk.db
# Run sql file in db
sqlite3 wonk.db < sqlite/scripts/createTables.sqlWhen modifying templ files, we need to generate their output go files. It can be done with the following command:
templ generateWhen we add a new Tailwind class we need the CSS to be updated. It can be done with the following command:
./tailwindcss -i static/css/input.css -o static/css/output.cssThe following command runs the server:
go run cmd/main.go
# NOTE: I use this command to run my own logger (There is no need, but I like colored logs)
go run ./cmd/main.go -logfmt=devlogRemembering and running all the commands above can be cumbersome, to fix this I use a Makefile.
This command will Generate the Templ files, generate the Tailwind file, and run the server.
make runwUnit tests and integration tests is used.
To run Unit tests:
go test ./... -vTo run integration test:
INTEGRATION=true go test ./... -v