A minimal yet powerful web application boilerplate using the GOTTH (golang, templ, tailwind, HTMX) stack:
Ensure you have the following installed before starting:
Clone the repository
git clone https://github.com/lordaris/gotth-boilerplate
cd gotth-boilerplate
Install Go dependencies
go mod tidy
Install Node dependencies
npm install
Configure the PostgreSQL database
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=gotth_boilerplate
# Server Configuration
PORT=8080
This .env file is essential for storing sensitive configuration values and should not be committed to version control.
make db-migrate
make dev
http://localhost:8080
in your browser.This project includes a Makefile
to simplify common operations, just remove the "copy" text from the file name and modify the project and database variables to your own:
# Install required tools
make install-tools
# Start development environment (Air + Tailwind)
make dev
# Database operations
make db-create # Create the database
make db-migrate # Run migrations
make db-reset # Reset the database
# Generate Templ files
make generate-templ
# See all available commands
make help
This boilerplate follows a kind of clean architecture approach, designed to be flexible and scalable for small to medium projects. The backend structure is consistent with my preferred approach, making it easy to navigate and extend.
The application includes basic templates, handlers, and HTMX examples. While the HTMX implementation is still a work in progress ( could and should be improved), it serves as a starting point for building dynamic interactions without excessive JavaScript.
Just head to the main page and experiment with the form interactions!
make generate-templ
every time you modify a .templ
file or update a handler function. Ideally, this process should be automated.For now, if you modify a templ
file, run:
make generate-templ
and restart the server using:
make run # or make dev
Feel free to improve on this template and make it your own. Happy coding!