Skip to content

tpl-x/go-htmx-starter

 
 

Repository files navigation

webpage

⚡ Go + HTMX Starter Kit

A powerful, minimal starter kit for building fast and beautiful web servers using Go, HTMX, and PostgreSQL. Everything you need to move from idea to production — quickly, cleanly, and with style.


✨ Core Stack

🐹 Go

A fast, reliable, and easy-to-learn language — perfect for modern web backends.

🌐 HTMX + Templ + Templui + Hyperscript + TailwindCSS

Build rich, reactive web interfaces using HTML-first development.

  • HTMX brings interactivity without JavaScript frameworks.
  • Templ and Templui power clean, type-safe UI components in Go.
  • Hyperscript makes DOM interactions effortless.
  • TailwindCSS gives you instant, elegant styling.

🔒 Authentication & Authorization

Session-based authentication with role-based privilege checks. Private routes can easily be secured with the PrivateRouteBuilder, which auto-manages privilege creation and enforcement.


🗄️ PostgreSQL + Jet

Type-safe database access with go-jet, a powerful query builder that generates Go code directly from your schema.


🧾 Logging with Zap

Clean, structured logging powered by Zap. Logging levels are automatically configured via your .env environment.


🐳 Docker Support

Run everything in a consistent, reproducible environment with Docker. Perfect for local development and deployment.


🔁 Live Reloading with Air

Enjoy fast iteration cycles using Air — your app reloads instantly on file changes.


🧰 Makefile Shortcuts

Automation made easy with make commands:

  • make live — run the app with live reload
  • make migrate-generate — create a new migration
  • Explore more in the Makefile »

Start fast. Scale beautifully. The Go + HTMX Starter Kit is your foundation for building production-ready web apps — effortlessly.


Dependencies


Installation

To run the application locally, follow these steps:

  1. Clone the repository and navigate to the project directory.
  2. Install Go and Docker.
  3. Setup your .env using the .env.example file as a template.

Running the Application with Docker

  1. Build and run the Docker image using the command make docker - when the controllers are built and run using make web it will create privileges associated with each controller and insert them into the database.
  2. In a separate terminal, run make seed to create 'basic' and 'admin' privilege levels and give all privileges to the admin level.
  3. Open your browser and navigate to http://localhost:8080 to access the application.
    • If you changed the PORT in your .env file, you will also need to update the Dockerfile.

OR

Running the Application Locally without Docker (Postgres still containerized)

  1. Install PostgreSQL, Make, and NPM on your machine. Start your PostgreSQL service.
  2. go mod download
  3. npm install
  4. Start the PostgreSQL container using the command: make docker-postgres
  5. Run migrations on the postgres container: make migrate
  6. make jet-all to generate all database objects and query building functionality.
  7. make live to start the server - this will create privileges associated with each controller and insert them into the database.
  8. In a separate terminal, run make seed to create 'basic' and 'admin' privilege levels and give all privileges to the admin level.
  9. Begin live development!

About

A starter kit with Go + HTMX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 73.0%
  • CSS 15.4%
  • templ 11.0%
  • Other 0.6%