# AGENTS.md - Nebula Project Guidelines ## Project Overview Nebula is a Go/Templ wallet application with HTMX 4 for server-driven UI and WebAwesome (wa-*) web components. **Stack**: Go 1.25+ | templ v0.3.977 | htmx 4.0.0-alpha5 | WebAwesome | SQLite WASM ## Build & Run Commands ```bash # Generate Go code from .templ files (REQUIRED after any .templ changes) templ generate # Build the project go build ./... # Run development server (serves on :8080) go run main.go # Watch mode for templ files templ generate --watch # Full build + run + open browser make all ``` ## Directory Structure ``` nebula/ ├── models/ # Data types (MVC models) ├── views/ # Page templates (.templ) ├── layouts/ # Base layouts (DashboardLayout, CenteredLayout) ├── components/ # Reusable UI components ├── handlers/ # HTTP route handlers ├── _migrate/ # HTML prototypes to convert ├── HTMX.md # htmx 4 patterns documentation └── SQLC.md # Database schema documentation ``` ## Code Style ### Go Files - Standard `gofmt` formatting - Package-level types in `models/` directory - Handlers in `handlers/routes.go` with pattern: `handleX(w http.ResponseWriter, r *http.Request)` - Use `r.Header.Get("HX-Request") == "true"` to detect HTMX requests - Return partials for HTMX, full pages for direct navigation ### Templ Files (.templ) - One main page template per file: `PageName(data ModelType) templ.Component` - Helper functions lowercase: `helperName()` - CSS-in-templ using `templ css` blocks or `