This repository is a starter template for building modern web applications using Golang, Templ, Tailwind CSS, and HTMX. It is designed to provide a clean and scalable structure to kickstart your development.
Ensure you have the following installed:
git clone https://github.com/AdamZeman/gotth-starter.git
cd gotth-starter
npm install
npx tailwindcss init
tailwind.config.js
file.templ
example/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./**/*.templ',
'./**/*.go',
],
theme: {
extend: {
colors: {
},
},
},
plugins: [],
};
go run main.go
npx tailwindcss -i ./css/input.css -o ./css/output.css --watch
Open your browser and navigate to http://localhost:4000
.
install
go install github.com/air-verse/air@latest
Create .air.toml config file
air init
Config the .toml file
exclude_regex = ["_test.go", "._templ.go"]
include_ext = ["go", "tpl", "tmpl", "html", "templ"]
air
Open your browser and navigate to http://localhost:4000
.
golang-templ-tailwind-htmx-starter/
├── css/ # Tailwind input/output CSS files
│ ├── input.css # Tailwind input file
│ ├── output.css # Compiled CSS (ignored by Git)
├── app/ # Main App folder
│ ├── handlers/ # Handlers + utils (.go files)
│ ├── views/ # Example handler for the home page
│ │ ├── components/ # Components for the layout and pages (.templ files)
│ │ ├── layouts/ # Layouts (.templ files)
│ │ ├── pages/ # Pages (.templ files)
├── go.mod # Go packages
├── main.go # Main application entry point
├── package.json # Tailwind configuration
├── .gitignore # Git ignore file
├── README.md # Project documentation
Templating:
.templ
files in the templates/
directory.Tailwind CSS:
input.css
file.tailwind.config.js
.Routing:
handlers/utils.go
and corresponding handlers in the handlers/
folder.npm run dev
npx tailwindcss -i ./css/input.css -o ./css/output.css --minify
Contributions are welcome! Feel free to open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.