My opinionated skeleton repository for a go web app.
go install golang.org/x/tools/cmd/gonew@latest
gonew github.com/mindcrackx/gonewtmpl-webserver github.com/myuser/myrepo
https://pre-commit.com/
pip install pre-commit
pre-commit install
pre-commit autoupdate
air
cd ./deployments/dev
docker compose up -d --build
The dev environment is a docker-compose with the containerized server plus preconfigured prometheus + grafana + dashboard.
Grafana: http://localhost:3000
-> user: admin
passwd: supersecret
./tools/sqlc.sh
https://www.conventionalcommits.org/
This project is the skeleton template for a go web app.
It is my default boilerplate:
- CI/CD with github-workflows and local testing with pre-commit
- cmd/server/main.go -> configuration and startup with graceful shutdown
- deployments -> docker-compose for local development with containers
- Dockerfile -> multi-stage builder for the webserver
- internal/metrics -> prometheus metrics (for grafana dashboard see deployments/dev/grafana_myapp_dashboard.json)
- internal/server -> "actual" server
- internal/db
- migration -> db-migration-scripts (up and down) for golang-migrate
- query -> sql commands for sqlc
- tools/sqlc.sh -> generating go boilerplate from sql with sqlc
- ui -> structure for static and template files. Gets embedded into the go binary. My current preferences are htmx, tailwind and if necessary alpinejs and some plain javascript.