Skip to content

Effiware/goth-template

 
 

Repository files navigation

🚀 GOTH Stack Complete Setup

Go Version Templ Tailwind CSS HTMX Alpine.js

A modern, fully configured starter template for building fast, type-safe web applications using Go, HTMX, Tailwind CSS, Alpine.js, and Templ. This stack provides an incredible developer experience with type safety from your database all the way to your HTML.

✨ Features

  • 📜 Type-Safe Templates: Using Templ for compile-time checked templates
  • 🔥 Hot Reload: Using Air for instant feedback during development
  • 🎨 HTMX + Tailwind: Modern, interactive UIs without complex client-side JavaScript
  • 🛠️ Modern JS Utilities: Alpine.js for lightweight interactivity
  • 📱 Responsive Design: Mobile-first approach with Tailwind CSS

🚀 Quick Start

Prerequisites

At least the following major versions are required (when installing on your local machine):

  • Go v1.25
  • npm v11.4
  • node v24.4
  • Air v1.63.0
  • Templ CLI 0.3.943
  • GNU Make 3.81 (recommended, but optional)

Or just use Docker for everything:

  • Docker 28.1 (recommended, but optional)

Usage

  1. Start the server using either local setup or Docker (see below).
  2. Open your browser and navigate to http://localhost:<app-port> (default is 8080).
  3. Play with HDA (interactions, dynamic content loading, etc.) and see changes instantly with hot reload!
  4. Play with API
    • get clicks count: curl http://localhost:8080/api/v1/clicks
    • increment clicks count: curl -X POST http://localhost:8080/api/v1/clicks/increment

Development Setup

Option 1: Local Machine

  1. Install dependencies

    make prep
  2. Build Tailwind and Go

    make build
  3. Run the application with Hot Reload using Air

     make air

Option 2: Docker (Recommended)

Either do make prep (will also install Go/Node dependencies on the host machine) or copy .env.example to .env and modify as needed.

  1. Build the Docker image

    make docker-build
  2. Run the Docker container

    make docker-up
  3. Stop the Docker container

    make docker-down

Access the Application

In both cases, open your browser and navigate to:

http://localhost:<local-port>

Note: The <app-port> should match the APP_PORT in your .env file.


Notes

Port taken

If you get an error that a port is already taken, you can change the port in the .env file or kill the process using it:

sudo lsof -i -P | grep LISTEN | grep :<PORT>

Then kill the process using the PID:

sudo kill -9 <PID>

Remove package

To remove a package, use the following command:

go mod edit -dropreplace <package>
go mod tidy

If you used go install package@latest then to remove:

go install package@none
go clean -cache -modcache

Hot-reloading explanation

There is an in detail explanation of how the hot reloading works in this article.

About

Generic GOTH stack template to start new HDA/API projects easily

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 69.7%
  • templ 16.1%
  • Makefile 8.3%
  • Dockerfile 4.3%
  • JavaScript 1.2%
  • CSS 0.4%