Skip to content

Commit a7765d2

Browse files
committed
refactor: replace Air with wgo for hot reload
wgo is simpler (zero config), more reliable, and supports parallel watchers natively. Removes .air.toml from generated apps. - Replace Air with wgo in Makefile (single `make dev` command) - Update `catuaba server` to use `wgo run .` - Remove .air.toml template - Update all docs and README references
1 parent a74e611 commit a7765d2

File tree

9 files changed

+17
-53
lines changed

9 files changed

+17
-53
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ That's it. You now have a running blog with:
3434
- Full CRUD for Posts — HTML views **and** JSON API
3535
- User registration and login with **bcrypt + sessions**
3636
- Database migrations, CSRF protection, flash messages
37-
- Hot-reload in development (Templ + Tailwind + Air)
37+
- Hot-reload in development (Templ + Tailwind + wgo)
3838
- Docker-ready for production
3939

4040
<br/>
@@ -129,7 +129,7 @@ go install github.com/dayvsonlima/catuaba@latest
129129

130130
- **Go 1.22+**
131131
- **Templ**`go install github.com/a-h/templ/cmd/templ@latest`
132-
- **Air** (optional, hot-reload) — `go install github.com/air-verse/air@latest`
132+
- **wgo** (hot-reload) — `go install github.com/bokwoon95/wgo@latest`
133133
- A database: PostgreSQL, MySQL, or SQLite
134134

135135
---
@@ -175,7 +175,7 @@ Open `http://localhost:8080` — done.
175175
Three watchers run in parallel:
176176
- **Templ** — recompiles `.templ` files on save
177177
- **Tailwind** — rebuilds CSS on save
178-
- **Air** — rebuilds and restarts the Go server
178+
- **wgo** — rebuilds and restarts the Go server
179179

180180
---
181181

@@ -496,7 +496,7 @@ make build
496496
### Make targets
497497

498498
```bash
499-
make dev # Hot-reload (templ + tailwind + air)
499+
make dev # Hot-reload (templ + tailwind + wgo)
500500
make build # Production binary
501501
make test # go test ./...
502502
make tidy # go mod tidy

cli/new/action.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ func Action(c *cli.Context) error {
126126
{"application/Makefile.tmpl", data.Name + "/Makefile"},
127127
{"application/dot-gitignore.tmpl", data.Name + "/.gitignore"},
128128
{"application/github-actions.yml.tmpl", data.Name + "/.github/workflows/ci.yml"},
129-
{"application/air.toml.tmpl", data.Name + "/.air.toml"},
130129
{"application/README.md.tmpl", data.Name + "/README.md"},
131130
{"application/CLAUDE.md.tmpl", data.Name + "/CLAUDE.md"},
132131
{"application/dot-mcp.json.tmpl", data.Name + "/.mcp.json"},

cli/server/action.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func Action(c *cli.Context) error {
1616
sigs := make(chan os.Signal, 1)
1717
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
1818

19-
cmd := exec.Command("air")
19+
cmd := exec.Command("wgo", "run", ".")
2020
cmd.Stdout = os.Stdout
2121
cmd.Stderr = os.Stderr
2222
cmd.Stdin = os.Stdin
@@ -29,8 +29,8 @@ func Action(c *cli.Context) error {
2929
}()
3030

3131
if err := cmd.Run(); err != nil {
32-
output.Error("Error running air: %v", err)
33-
output.Info("Make sure 'air' is installed: go install github.com/air-verse/air@latest")
32+
output.Error("Error running wgo: %v", err)
33+
output.Info("Make sure 'wgo' is installed: go install github.com/bokwoon95/wgo@latest")
3434
return err
3535
}
3636

docs/views.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ During development, `make dev` runs the Tailwind watcher that recompiles on save
233233

234234
1. Edit `.templ` files
235235
2. Templ watcher recompiles to `_templ.go` files
236-
3. Air detects the Go file change and rebuilds the server
236+
3. wgo detects the Go file change and rebuilds the server
237237
4. Browser refreshes (or HTMX swaps the content)
238238

239239
All three watchers run in parallel with `make dev`.

generator/templates/application/CLAUDE.md.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Catuaba app — Go + Gin + GORM + Templ + HTMX + Tailwind CSS.
55
## Commands
66

77
```bash
8-
make dev # Start dev server (templ + tailwind + air hot-reload)
8+
make dev # Start dev server (templ + tailwind + wgo hot-reload)
99
make build # Production build
1010
make test # Run all tests
1111
make tidy # go mod tidy

generator/templates/application/Makefile.tmpl

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
1-
.PHONY: run build test lint clean docker-up docker-down dev templ-watch css-watch air-watch
1+
.PHONY: dev build test lint clean docker-up docker-down tidy help
22

33
APP_NAME={{.Name}}
44

5-
## dev: Start development (templ + tailwind + air)
5+
## dev: Start development with hot reload (templ + tailwind + go)
66
dev:
7-
@make -j3 templ-watch css-watch air-watch
8-
9-
## templ-watch: Watch and regenerate templ files
10-
templ-watch:
11-
@templ generate --watch
12-
13-
## css-watch: Watch and rebuild Tailwind CSS
14-
css-watch:
15-
@npx @tailwindcss/cli -i static/css/input.css -o static/css/app.css --watch
16-
17-
## air-watch: Start air for hot reload
18-
air-watch:
19-
@air
20-
21-
## run: Start the application with hot reload (requires air)
22-
run:
23-
@air
7+
@wgo -file .go -file .templ templ generate :: \
8+
wgo run . :: \
9+
wgo -file .templ -file .css npx @tailwindcss/cli -i static/css/input.css -o static/css/app.css --watch
2410

2511
## build: Build the application binary
2612
build:

generator/templates/application/README.md.tmpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ A web application built with [Catuaba](https://github.com/dayvsonlima/catuaba)
99
go mod tidy
1010
1111
# Start the development server (with hot reload)
12-
catuaba server
13-
# or
14-
make run
12+
make dev
1513
```
1614

1715
The server starts at `http://localhost:8080`.
1816

1917
## Available Commands
2018

2119
```bash
22-
make run # Start development server with hot reload
20+
make dev # Start development server with hot reload
2321
make build # Build for production
2422
make test # Run tests
2523
```

generator/templates/application/air.toml.tmpl

Lines changed: 0 additions & 19 deletions
This file was deleted.

generator/templates/application/dot-gitignore.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Thumbs.db
2929
# Vendor (uncomment if not vendoring)
3030
# vendor/
3131

32-
# Air tmp
32+
# Build tmp
3333
tmp/
3434

3535
# SQLite

0 commit comments

Comments
 (0)