CLI Reference
The gofasta CLI is a single static binary. It creates projects, generates code inside them, runs the local dev loop, and reports on project state. It never becomes a runtime dependency of your service — it manipulates files and shells out to standard Go tooling.
Every command honors the global --json flag: progress output moves to stderr and stdout carries a machine-readable document, which is what makes the CLI safe to drive from scripts and AI coding agents.
Starting a project
| Command | What it does |
|---|---|
gofasta new | Create a project scaffold — REST (optionally GraphQL), migrations, auth, DI, jobs, Docker, CI. Picks the database engine with --driver and adds GraphQL with --graphql. |
gofasta init | Initialize a cloned or existing project — install dependencies and run the code generators. |
gofasta doctor | Check system prerequisites, project configuration, and database connectivity. |
The dev loop
| Command | What it does |
|---|---|
gofasta dev | Bring the whole local environment up with one command — compose services, migrations, and Air hot reload, with interactive restart. |
gofasta debug | CLI surface for the /debug/* endpoints — requests, SQL, traces, logs, errors, cache, pprof, EXPLAIN, HAR, plus composed diagnostics. |
gofasta serve | Start the production HTTP server: compiled binary, config.yaml, DB/cache/queue connections, REST and GraphQL endpoints. |
gofasta console | Interactive Go REPL inside your project (via yaegi) for poking at services, repos, and the DI container live. |
Inspecting the project
These are the commands built for automation — each emits structured output and reads the project statically, without a running server.
| Command | What it does |
|---|---|
gofasta verify | Run the full preflight gauntlet — gofmt, vet, golangci-lint, tests, build, Wire drift, routes — in one command. |
gofasta test | Run go test with Gofasta defaults (race detector, every package, live output) plus short/integration/coverage shortcuts. |
gofasta status | Report project health: Wire drift, swagger drift, pending migrations, uncommitted generated files, module freshness. |
gofasta inspect | Show a resource’s full composition — model fields, DTOs, service methods, controller methods, routes. |
gofasta inspect-jobs | Static AST scan of app/jobs/ listing every registered cron job with its schedule from config.yaml. |
gofasta inspect-tasks | Static AST scan of app/tasks/ listing every async task with its wire name, payload shape, and handler presence. |
gofasta impact | Reverse-dependency analysis — every package (direct and transitive) that depends on a given file or import path. |
gofasta xrefs | Type-aware reverse symbol lookup across the module — survives renames, aliasing, and method-set resolution. |
gofasta routes | Print every registered REST route — method, path, handler, chained middleware — read statically from the route registrations. |
gofasta config | Inspect and validate config.yaml; currently the schema emitter. |
Generating and reshaping code
| Command | What it does |
|---|---|
gofasta generate | The generator family (shorthand g) — scaffolds, per-layer generators, surface-add commands, jobs, tasks, and mocks. |
gofasta refactor | Switch between layered and feature-package layouts with a bidirectional AST-based migration and safety gates. |
gofasta wire | Regenerate the Google Wire dependency-injection code. |
gofasta swagger | Generate docs/swagger.json and docs/swagger.yaml from the annotations the scaffold emits. |
Database
| Command | What it does |
|---|---|
gofasta migrate | Run migrations up or down, with static analysis (--explain), safe rollbacks (--steps, --all), and dirty-state repair. |
gofasta seed | Run database seeders to populate initial or test data. |
gofasta db | Database management commands for resetting and managing the development database. |
Shipping and maintenance
| Command | What it does |
|---|---|
gofasta deploy | Deploy to a remote VPS over SSH using Docker or a compiled binary. |
gofasta ai | Install per-agent configuration for Claude Code, Cursor, OpenAI Codex, Aider, and Windsurf — allowlists, hooks, project rules, slash commands. |
gofasta do | Run a named development workflow — a predefined chain of commands that accomplishes one higher-level task. |
gofasta upgrade | Self-update the CLI to the latest release — go install or checksum-verified binary replacement, chosen automatically. |
gofasta version | Print the CLI version, the Go version it was built with, and the OS/architecture target. |
Reference
- Error codes — Every structured code the CLI can emit, with the remediation hint attached to each. These are the identifiers
--jsonconsumers branch on.
Last updated on