Published: 2025-01-26 22:43
Building a modern web application typically takes weeks of setup and configuration. You need to choose and configure a web framework, set up templates, handle CSS, create deployment pipelines, and more. But what if you could skip straight to building features? That's why I created go-htmx-forge, a template that gives you everything you need to build and deploy a modern web app in a day.
In less than 10 minutes, you'll have:
No more spending days on configuration. Everything just works.
Here's how quickly you can get started:
# Clone the template (2 minutes)
git clone https://github.com/jrswab/go-htmx-forge your-project
# Install dependencies (5 minutes)
go mod tidy
npm install tailwindcss
go install github.com/a-h/templ/cmd/templ@latest
# Start development (1 minute)
make run
Visit localhost:3000 and you're ready to build features. No configuration needed.
Let's add a dynamic user counter to show how quickly you can build real features. Here's all it takes:
Create a template (user_counter.templ):
package views
templ UserCounter(count int) {
<div id="counter">
<p>Current Users: {count}</p>
<button hx-post="/increment" hx-target="#counter">
Increment
</button>
</div>
}
Add a handler (handlers/counter.go):
package handlers
func IncrementCounter(c echo.Context) error {
count++ // Using a global for this example
return c.Render(http.StatusOK, UserCounter(count))
}
Add the route (main.go):
app.POST("/increment", handlers.IncrementCounter)
That's it! You now have a dynamic counter that updates without page refreshes. No JavaScript required.
Here's what you'd typically spend days setting up manually:
CI/CD Pipeline (2-3 days saved)
Frontend Tools (1-2 days saved)
Production Setup (2-3 days saved)
With the basics handled, you can focus on what matters:
Design Your Data Models (1-2 hours)
Create Your Views (2-3 hours)
Test and Deploy (1 hour)
When you're ready to go live, the template handles deployment for you:
PR Workflow tests changes in isolation:
Production Workflow handles going live:
I chose OpenBSD as the target platform for its security, reliability, and simplicity. The template configures everything you need:
This template is just the beginning. Future updates will include:
go-htmx-forge is open source under the BSD 3-Clause license. Want to build your web app today?
Stop wasting time on setup and start building features that matter. With go-htmx-forge, you can have your web app running in production today.