Go is fast, simple, and deploys as a single binary. But starting a web project from scratch means wiring up routers, ORMs, templates, auth, CSRF, sessions, migrations, Docker... hours of boilerplate before you write your first feature.
Catuaba fixes that. One command gives you a production-ready app. Another gives you a full CRUD with views, API, and database â in seconds.
bashcatuaba new blog --db postgres --auth cd blog catuaba g scaffold Post title:string content:text published:boolean make dev
That's it. You now have a running blog with:
- Landing page styled with Tailwind CSS
- Full CRUD for Posts â HTML views and JSON API
- User registration and login with bcrypt + sessions
- Database migrations, CSRF protection, flash messages
- Hot-reload in development (Templ + Tailwind + wgo)
- Docker-ready for production
Why Catuaba?
| You want | Catuaba gives you |
|---|---|
| Start a project fast | catuaba new myapp â full app in 3 seconds |
| CRUD without boilerplate | catuaba g scaffold â model, views, API, routes, migration |
| Type-safe HTML | Templ â compiled templates, IDE autocomplete, no interface{} |
| Interactivity without JS frameworks | HTMX + Alpine.js â 31kb total |
| Production CSS | Tailwind CSS â standalone binary, no Node.js |
| Auth that just works | --auth â login, register, logout, sessions, bcrypt |
| AI-powered development | Built-in MCP server â Claude/Cursor understand your project |
| Deploy anywhere | Single binary + Docker. That's Go. |
The Stack
| Layer | Technology |
|---|---|
| HTTP | Gin |
| ORM | GORM â Postgres, MySQL, SQLite |
| Views | Templ â type-safe, compiled HTML |
| Interactivity | HTMX + Alpine.js |
| CSS | Tailwind CSS |
| Sessions | SCS |
| Migrations | Raw SQL (up/down) via golang-migrate |
Install
Binary (recommended)
macOS (Apple Silicon)
bashcurl -L https://github.com/dayvsonlima/catuaba/releases/latest/download/catuaba-darwin-arm64.tar.gz | tar xz sudo mv catuaba /usr/local/bin/
macOS (Intel)
bashcurl -L https://github.com/dayvsonlima/catuaba/releases/latest/download/catuaba-darwin-amd64.tar.gz | tar xz sudo mv catuaba /usr/local/bin/
Linux
bashcurl -L https://github.com/dayvsonlima/catuaba/releases/latest/download/catuaba-linux-amd64.tar.gz | tar xz sudo mv catuaba /usr/local/bin/
Windows â download from releases, extract, add to PATH.
From source
bashgo install github.com/dayvsonlima/catuaba@latest
Prerequisites
- Go 1.22+
- Templ â
go install github.com/a-h/templ/cmd/templ@latest - wgo (hot-reload) â
go install github.com/bokwoon95/wgo@latest - A database: PostgreSQL, MySQL, or SQLite
Getting Started
1. Create your app
bashcatuaba new myapp --db postgres cd myapp go mod tidy
Flags:
--db postgres|mysql|sqlite(default: postgres)--authâ adds login, register, logout
2. Generate a resource
bashcatuaba g scaffold Post title:string content:text published:boolean
This creates everything:
| What | Where |
|---|---|
| Model | app/models/post.go |
| Migration | database/migrations/*_create_posts.{up,down}.sql |
| HTML handlers | app/controllers/posts/ (index, show, new, create, edit, update, delete) |
| Templ views | app/views/posts/ (index, show, form) |
| Routes | Auto-injected into config/routes.go |
3. Start developing
bashmake dev
Open http://localhost:8080 â done.
Three watchers run in parallel:
- Templ â recompiles
.templfiles on save - Tailwind â rebuilds CSS on save
- wgo â rebuilds and restarts the Go server
Generators
All generators run inside your project directory with catuaba g <generator>.
Full-stack scaffold
bashcatuaba g scaffold Product name:string price:float description:text active:boolean
Creates model + migration + HTML handlers + Templ views + JSON API + routes. This is the fastest way to build features.
HTML routes:
| Method | Path | Description |
|---|---|---|
| GET | /products | List with pagination |
| GET | /products/new | New form |
| POST | /products | Create |
| GET | /products/:id | Detail view |
| GET | /products/:id/edit | Edit form |
| POST | /products/:id | Update |
| POST | /products/:id/delete | Delete |
JSON API routes:
| Method | Path |
|---|---|
| GET | /api/products |
| POST | /api/products |
| GET | /api/products/:id |
| PUT/PATCH | /api/products/:id |
| DELETE | /api/products/:id |
API only
bashcatuaba g api Order total:float status:string
Same as scaffold but without HTML views â JSON API only.
Model
bashcatuaba g model Category name:string description:text
Creates model + SQL migration.
Other generators
bashcatuaba g controller Auth login logout # Controller with methods catuaba g middleware RateLimit # Middleware catuaba g service EmailSender # Service layer catuaba g seed Posts # Database seed catuaba g migration add_category_id_to_posts # Empty SQL migration catuaba g view about # Templ page
Field types
| Type | Go | SQL | HTML |
|---|---|---|---|
string | string | VARCHAR(255) | text input |
text | string | TEXT | textarea |
integer | int | INTEGER | number input |
float | float64 | REAL | number input |
boolean | bool | BOOLEAN | checkbox |
datetime | time.Time | TIMESTAMP | datetime-local |
Commands
| Command | Description |
|---|---|
catuaba new <name> | Create application |
catuaba g scaffold <name> [fields...] | Full-stack CRUD |
catuaba g api <name> [fields...] | JSON API |
catuaba g model <name> [fields...] | Model + migration |
catuaba g controller <name> [methods...] | Controller |
catuaba g middleware <name> | Middleware |
catuaba g service <name> | Service |
catuaba g seed <name> | Database seed |
catuaba g migration <name> | SQL migration |
catuaba g view <name> | Templ view page |
catuaba server | Start server |
catuaba routes | List all routes |
catuaba db migrate | Run pending migrations |
catuaba db rollback | Rollback last migration |
catuaba db status | Migration status |
catuaba install <plugin> | Install plugin |
catuaba mcp | Start MCP server |
Documentation
For detailed guides on each part of the framework:
- Models â GORM models, field types, relationships, migrations, querying
- Controllers â HTML handlers vs JSON API, form binding, route patterns
- Views â Templ templates, layouts, components, HTMX, Alpine.js, Tailwind CSS
- Middleware â Built-in stack, CSRF, sessions, flash messages, auth, custom middleware
External references:
| Topic | Link |
|---|---|
| HTTP framework | Gin documentation |
| ORM | GORM documentation |
| Views | Templ guide |
| Interactivity | HTMX documentation |
| Client-side JS | Alpine.js documentation |
| CSS | Tailwind CSS documentation |
| Sessions | SCS documentation |
| Migrations | golang-migrate |
Project Structure
myapp/ âââ application.go # Entrypoint: middleware stack, routes, graceful shutdown âââ Makefile # dev, build, test, docker âââ Dockerfile # Multi-stage production build âââ docker-compose.yml # App + database âââ .env # Environment variables âââ config/ â âââ config.go # Env vars â AppConfig struct â âââ routes.go # Routes (auto-managed by generators) âââ database/ â âââ connection.go # GORM connection + migration runner â âââ migrations/ # SQL files (up/down) âââ app/ â âââ models/ # GORM models â âââ controllers/ â â âââ home.go # Home page â â âââ {resource}/ # HTML handlers (scaffold) â â âââ api/{resource}/ # JSON handlers (api/scaffold) â âââ views/ â âââ layouts/base.templ # HTML5 layout: head, nav, flash, footer â âââ components/ # Reusable: nav, flash, pagination, form fields â âââ pages/ # Static pages: home, 404 â âââ {resource}/ # CRUD views: index, show, form âââ middleware/ # Full stack (see below) âââ static/css/ # Tailwind source + compiled output
Middleware
Every app comes with a production-ready middleware stack â no configuration needed:
| Middleware | What it does |
|---|---|
| Health | GET /health returns 200 |
| RequestID | X-Request-ID on every response |
| Logger | Structured JSON: method, path, status, latency |
| Recovery | Catches panics â 500 |
| SecureHeaders | HSTS, X-Frame-Options, CSP |
| CORS | Configurable via CORS_ALLOWED_ORIGIN |
| RateLimit | Token bucket: 10 req/s, burst 40 |
| Session | SCS cookie sessions |
| CSRF | Auto token validation (skips /api/ routes) |
| Flash | Flash messages: success, error, warning |
Authentication
bashcatuaba new myapp --db postgres --auth
Generates a complete auth system:
GET /registerâ registration formPOST /registerâ create accountGET /loginâ login formPOST /loginâ authenticatePOST /logoutâ destroy sessionRequireAuth()middleware â protects routes, redirects to/login
Passwords are hashed with bcrypt. Sessions use SCS (cookie-based, OWASP-compliant).
Database
Drivers
| Driver | Flag | Example |
|---|---|---|
| PostgreSQL | --db postgres | Default. Docker Compose included |
| MySQL | --db mysql | Docker Compose included |
| SQLite | --db sqlite | Zero config, file-based |
Migrations
Raw SQL, versioned, up/down:
bash# Auto-generated with models and scaffolds database/migrations/20240101120000_create_posts.up.sql database/migrations/20240101120000_create_posts.down.sql # Manual migration catuaba g migration add_slug_to_posts # Run / rollback / check catuaba db migrate catuaba db rollback catuaba db status
MCP Server (AI Integration)
Catuaba ships with a built-in MCP server. AI coding assistants (Claude Code, Cursor, Windsurf) can understand your project structure and generate code â without reading every file.
Setup
Every generated app includes a .mcp.json file â just open the project in Claude Code or Cursor and the MCP server is auto-discovered.
For manual setup, add to your .mcp.json or claude_desktop_config.json:
json{ "mcpServers": { "catuaba": { "command": "catuaba", "args": ["mcp"] } } }
What the AI gets
Resources â your project as compact JSON:
| Resource | Returns |
|---|---|
catuaba://project/overview | Module, Go version, DB, port, plugins, directories |
catuaba://project/models | All models with fields, types, tags |
catuaba://project/routes | All routes: method, path, handler |
catuaba://project/controllers | All controllers and functions |
catuaba://project/middleware | All middleware functions |
catuaba://project/env | Env var names (no values) |
Tools â generate code through the AI:
| Tool | What it does |
|---|---|
generate_scaffold | Full CRUD: model + handlers + views + API + routes |
generate_model | Model + SQL migration |
get_model | Inspect model details |
get_routes | List routes (filterable by prefix) |
get_logs | Recent app logs (filterable by level/path) |
run_command | Run any catuaba generate subcommand |
install_plugin | Install a plugin |
Every generated app also includes a CLAUDE.md with framework conventions, so AI assistants follow the right patterns automatically.
Plugins
Extend Catuaba with plugins:
bashcatuaba install stripe-payments # From registry catuaba install https://github.com/user/my-plugin # From git catuaba install ./local-plugin # From local path catuaba plugin list # Browse registry catuaba plugin info stripe-payments # Details
Plugins are defined by a plugin.yaml manifest and can add files, inject routes, add imports, insert struct fields, and set environment variables.
Deploy
Docker (recommended)
bashdocker compose up -d --build
The generated Dockerfile is a multi-stage build:
- Installs Templ + builds templates
- Builds Tailwind CSS (minified)
- Compiles Go binary with
-ldflags="-w -s" - Runs on
alpine:3.19(~15MB image)
Manual
bashmake build ./bin/myapp
Development
Make targets
bashmake dev # Hot-reload (templ + tailwind + wgo) make build # Production binary make test # go test ./... make tidy # go mod tidy make docker-up # Docker Compose up make docker-down # Docker Compose down
Contributing
Contributions are welcome!
bashgit clone https://github.com/dayvsonlima/catuaba.git cd catuaba go mod tidy go test -v ./...
- Fork the repo
- Create your branch (
git checkout -b feature/my-feature) - Run tests (
go test ./...) - Submit a PR
License
MIT License â see LICENSE for details.




