Skip to Content
DocumentationCLI Reference

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

CommandWhat it does
gofasta newCreate a project scaffold — REST (optionally GraphQL), migrations, auth, DI, jobs, Docker, CI. Picks the database engine with --driver and adds GraphQL with --graphql.
gofasta initInitialize a cloned or existing project — install dependencies and run the code generators.
gofasta doctorCheck system prerequisites, project configuration, and database connectivity.

The dev loop

CommandWhat it does
gofasta devBring the whole local environment up with one command — compose services, migrations, and Air hot reload, with interactive restart.
gofasta debugCLI surface for the /debug/* endpoints — requests, SQL, traces, logs, errors, cache, pprof, EXPLAIN, HAR, plus composed diagnostics.
gofasta serveStart the production HTTP server: compiled binary, config.yaml, DB/cache/queue connections, REST and GraphQL endpoints.
gofasta consoleInteractive 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.

CommandWhat it does
gofasta verifyRun the full preflight gauntlet — gofmt, vet, golangci-lint, tests, build, Wire drift, routes — in one command.
gofasta testRun go test with Gofasta defaults (race detector, every package, live output) plus short/integration/coverage shortcuts.
gofasta statusReport project health: Wire drift, swagger drift, pending migrations, uncommitted generated files, module freshness.
gofasta inspectShow a resource’s full composition — model fields, DTOs, service methods, controller methods, routes.
gofasta inspect-jobsStatic AST scan of app/jobs/ listing every registered cron job with its schedule from config.yaml.
gofasta inspect-tasksStatic AST scan of app/tasks/ listing every async task with its wire name, payload shape, and handler presence.
gofasta impactReverse-dependency analysis — every package (direct and transitive) that depends on a given file or import path.
gofasta xrefsType-aware reverse symbol lookup across the module — survives renames, aliasing, and method-set resolution.
gofasta routesPrint every registered REST route — method, path, handler, chained middleware — read statically from the route registrations.
gofasta configInspect and validate config.yaml; currently the schema emitter.

Generating and reshaping code

CommandWhat it does
gofasta generateThe generator family (shorthand g) — scaffolds, per-layer generators, surface-add commands, jobs, tasks, and mocks.
gofasta refactorSwitch between layered and feature-package layouts with a bidirectional AST-based migration and safety gates.
gofasta wireRegenerate the Google Wire dependency-injection code.
gofasta swaggerGenerate docs/swagger.json and docs/swagger.yaml from the annotations the scaffold emits.

Database

CommandWhat it does
gofasta migrateRun migrations up or down, with static analysis (--explain), safe rollbacks (--steps, --all), and dirty-state repair.
gofasta seedRun database seeders to populate initial or test data.
gofasta dbDatabase management commands for resetting and managing the development database.

Shipping and maintenance

CommandWhat it does
gofasta deployDeploy to a remote VPS over SSH using Docker or a compiled binary.
gofasta aiInstall per-agent configuration for Claude Code, Cursor, OpenAI Codex, Aider, and Windsurf — allowlists, hooks, project rules, slash commands.
gofasta doRun a named development workflow — a predefined chain of commands that accomplishes one higher-level task.
gofasta upgradeSelf-update the CLI to the latest release — go install or checksum-verified binary replacement, chosen automatically.
gofasta versionPrint 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 --json consumers branch on.
Last updated on