A modern, production-ready web application template using Go, HTMX, and the latest Tailwind CSS v4.
- Go + Echo: High-performance web framework
- HTMX: Build dynamic interfaces without writing JavaScript
- Tailwind CSS v4: Latest version with CSS-first configuration
- templ: Type-safe HTML templates for Go
- Task: Modern task runner and build tool
- Live Reload: Development server with hot reloading for Go, templates, and CSS
- PostgreSQL + sqlc: Type-safe SQL with Go
- Air: Live reload for Go code
- Backend: Go 1.22+ with Echo framework
- Frontend:
- HTMX for dynamic interactions
- Tailwind CSS v4 for styling
- templ for type-safe templates
- Database: PostgreSQL with sqlc for type-safe queries
- Development:
- Task for running development commands
- Air for live reloading
- Docker for PostgreSQL (optional)
- Go 1.22 or later
- Task (task runner)
- PostgreSQL 15 or later
- Docker (optional, for containerized database)
-
Clone the repository
git clone https://github.com/yourusername/your-repo-name cd your-repo-name -
Set up the database
Using Docker (recommended for development):
task db-docker-up # Starts PostgreSQL in Docker task db-setup # Creates database and runs migrations
Using local PostgreSQL:
# Create the database createdb your_db_name # Run migrations task db-setup
-
Install tools and dependencies
task install-tools task download-deps
-
Configure environment
cp .env.example .env # Edit .env with your database credentials -
Start development server
task dev
This will start:
- Go server with live reload on :6969
- Tailwind CSS in watch mode
- templ template compilation in watch mode
-
Visit http://localhost:6969
.
├── bin/ # Binary tools (Tailwind, etc.)
├── cmd/ # Application entrypoints
├── internal/
│ ├── database/ # Database related code
│ │ ├── migrations/ # SQL migrations
│ │ ├── queries/ # SQL queries
│ │ └── sqlc.yaml # sqlc configuration
│ ├── handlers/ # HTTP handlers
│ ├── models/ # Data models
│ └── templates/ # templ templates
├── static/
│ ├── css/ # CSS files
│ │ ├── input.css # Tailwind CSS entry
│ │ └── output.css # Generated CSS
│ └── js/ # JavaScript files
├── .env.example # Example environment variables
├── docker-compose.yml # Docker services definition
└── Taskfile.yml # Task runner configuration
This template uses Tailwind CSS v4 with its new CSS-first configuration:
@import "tailwindcss";
@source "./internal/templates/**/*.{templ,go}";
@plugin "./static/js/daisyui.js" {
themes: emerald --default, dark --prefers-dark
}
/* Custom styles here */Key features:
- No
tailwind.config.jsneeded - CSS-first configuration
- Built-in source detection
- Native dark mode support
- Modern color system with OKLCH
task dev: Start development server with live reloadtask build: Build for productiontask css-watch: Watch and compile CSS changestask css-build: Build CSS for productiontask templ-generate: Generate Go code from templatestask templ-watch: Watch and compile template changes
task db-docker-up: Start PostgreSQL in Dockertask db-docker-down: Stop PostgreSQL containertask db-setup: Create database and run migrationstask db-create-migration name=example: Create a new migrationtask db-migrate: Run pending migrationstask db-rollback: Rollback last migrationtask db-status: Check migration statustask db-generate: Generate Go code from SQL queries using sqlc
-
Build for production
task build
-
Set up the database
# Configure your production database URL in .env task db-migrate -
Run the server
./bin/server
- Echo Framework Documentation
- HTMX Documentation
- Tailwind CSS v4 Documentation
- templ Documentation
- Task Documentation
- sqlc Documentation
- PostgreSQL Documentation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.