An opinionated template to spin up a Go web server using the Gin package.
Ensure you have Go 1.25 installed.
Install the relevant tools listed below:
go install github.com/a-h/templ/cmd/templ@latest
go install github.com/air-verse/air@latestEnsure your $GOPATH is set correctly as specified here.
Refer to Makefile for package commands; i.e. make dev.
Refer to router.go for available routes.
For building with Vite, run npm run dev in the frontend folder.
Start the backend server with make dev.
Open the url http://localhost:8081, for hot reloading; albeit the html templates will be slow.
docker build -t myapp:latest .
# Without swap (recommended for containers)
# Same as memory = no swap allowed
# Disable swapping to disk
docker run -d \
--name myapp \
--memory=64m \
--memory-swap=64m \
--memory-swappiness=0 \
--cpus="0.5" \
-p 8080:8080 \
-p 6060:6060 \
-e GIN_MODE=release \
myapp:latest
cd ./cmd/loadtest/
./start.sh
# Evaluate the respective pprof output
go tool pprof -http=:8081 ./<metric>.pprof