Skip to Content

Quick Start

Five minutes, four commands, a working backend with REST + database + hot reload + observability + interactive controls.

Step 1: Create a Project

gofasta new myapp

Or with a full Go module path:

gofasta new github.com/myorg/myapp

This scaffolds a REST-only project. Add --graphql if you want gqlgen + a /graphql endpoint + playground generated alongside REST:

gofasta new myapp --graphql

The output narrates every step — Wire DI generation, go mod tidy, git init, the works. By the time it finishes you have a project that compiles, runs, has a starter User resource, and can be deployed as-is.

Step 2: Start the Dev Loop

cd myapp gofasta dev

That single command brings up everything: the database (Postgres in Docker), the cache (Redis), the queue dashboard (asynqmon), runs pending migrations, then launches Air for hot-reload on the host. Everything tears down cleanly on Ctrl+C.

What’s actually happening under the hood:

StageWhat runs
1. PreflightVerifies docker and docker compose are available.
2. Service startdocker compose up -d with the cache + queue profiles auto-activated. db, redis, and asynqmon come up together.
3. Health-waitPolls each service’s compose healthcheck until ready (30s timeout).
4. MigrateRuns migrate up against the now-healthy database.
5. AirExecs go tool air against .air.toml — your code rebuilds on every save.
6. TeardownOn Ctrl+C, stops services (volumes preserved so the next run reuses your data).

Your app is live at:

EndpointURL
REST APIhttp://localhost:8080/api/v1/
Health checkhttp://localhost:8080/health
Prometheus metricshttp://localhost:8080/metrics
Swagger UIhttp://localhost:8080/swagger/index.html (after gofasta swagger)

If you scaffolded with --graphql:

EndpointURL
GraphQLhttp://localhost:8080/graphql
GraphQL Playgroundhttp://localhost:8080/graphql-playground

Interactive controls while it’s running

gofasta dev puts your terminal in raw mode and listens for single-key shortcuts. You’ll see a banner the moment the loop starts:

⌨ press `r` to restart · `q` to quit · `h` for help
KeyAction
r / RRestart the entire pipeline from scratch — services stop, .env reloads, every stage re-runs. Use this after editing .env, config.yaml, or rebasing migrations. Air-watched Go files don’t need it; Air picks those up automatically.
q / QQuit cleanly. Same effect as Ctrl+C.
h / H / ?Print the keybinding help inline.

The listener auto-disables when stdin isn’t a TTY (CI runs, piped input). Pass --no-keyboard to disable it explicitly.

Useful flags

FlagWhat it does
gofasta dev --dry-runPrint what would run, exit. Great in CI to validate compose + config without spinning anything up.
gofasta dev --freshDrop every compose volume before starting. Clean slate database.
gofasta dev --seedRun seeders after migrations.
gofasta dev --no-cacheSkip the cache (Redis). Use when you don’t need it.
gofasta dev --no-queueSkip the queue dashboard.
gofasta dev --no-servicesSkip compose entirely. Air only — use when you bring your own database.
gofasta dev --all-in-dockerRun everything in Docker, including Air. Supporting services run detached; the app container’s stdout streams to your terminal so hot-reload feels identical to host-Air.
gofasta dev --dashboardSpin up the dev dashboard on :9090 — live routes, request inspector, trace waterfall, EXPLAIN-on-click, panic history, cache hit/miss, HAR export. Only available with the devtools build tag, which gofasta dev sets automatically.
gofasta dev --attach-logsStream docker compose logs -f alongside Air output.
gofasta dev --jsonNDJSON event stream instead of human log lines — for CI and agents.

Full reference at /docs/cli-reference/dev.

Step 3: Generate a Resource

In a separate terminal (leave gofasta dev running):

gofasta g scaffold Product name:string price:float

This generates 11 files and patches 4 existing files in one shot:

Generated fileWhat it is
app/models/product.model.goDatabase model
db/migrations/000006_create_products.up.sqlCreate table migration
db/migrations/000006_create_products.down.sqlDrop table migration
app/repositories/interfaces/product_repository.goRepository interface
app/repositories/product.repository.goRepository implementation (GORM)
app/services/interfaces/product_service.goService interface
app/services/product.service.goService implementation
app/dtos/product.dtos.goRequest/response DTOs with validation
app/di/providers/product.goWire DI provider
app/rest/controllers/product.controller.goREST controller
app/rest/routes/product.routes.goRoute definitions (GET, POST, PUT, DELETE)

Plus automatic patches to wire everything in:

  • app/di/container.goProductService + ProductController fields
  • app/di/wire.goProductSet added to the Wire build
  • app/rest/routes/index.routes.go/api/v1/products registered
  • cmd/serve.go — controller wired into route config

If you scaffolded the project with --graphql, pass --graphql here too and the resolver + .gql schema get generated alongside.

Press r to apply

Back in the gofasta dev terminal, press r. The pipeline tears down, re-runs preflight, re-applies migrations (your new 000006_create_products runs), and Air rebuilds against the new generated code. Your /api/v1/products endpoint is now live — no manual gofasta migrate up, no separate restart cycle.

Air does pick up .go saves automatically. You only need r for things outside Air’s watch — migrations, config changes, .env edits.

Step 4: Test Your API

# Create a product curl -X POST http://localhost:8080/api/v1/products \ -H "Content-Type: application/json" \ -d '{"name": "Widget", "price": 9.99}' # List curl http://localhost:8080/api/v1/products # Get one curl http://localhost:8080/api/v1/products/{id} # Update curl -X PUT http://localhost:8080/api/v1/products/{id} \ -H "Content-Type: application/json" \ -d '{"name": "Updated Widget", "price": 19.99}' # Delete curl -X DELETE http://localhost:8080/api/v1/products/{id}

Want to see every captured request, SQL query, and trace span live? Start gofasta dev --dashboard and open http://localhost:9090. Click a request row → see its trace waterfall, the SQL it ran, the response body, and a one-click Replay button.

Supported Field Types

TypeGo typeSQL type (Postgres)GraphQL type
stringstringVARCHAR(255)String
textstringTEXTString
intintINTEGERInt
floatfloat64DECIMAL(10,2)Float
boolboolBOOLEANBoolean
uuiduuid.UUIDUUIDID
timetime.TimeTIMESTAMPDateTime

SQL types are automatically adapted for MySQL, SQLite, SQL Server, and ClickHouse based on the database.driver in your config.yaml.

What’s next

  • gofasta dev — full reference — every flag, every event, the dashboard’s debug surfaces (trace waterfall, EXPLAIN-on-click, N+1 detection, HAR export)
  • Code generation — every generator: model, repository, service, controller, job, task, email-template, resolver
  • Configurationconfig.yaml schema, env-var overrides, multi-database support
  • Authentication — JWT + Casbin RBAC, scaffolded auth flows
  • Agent integrationsgofasta ai claude, cursor, codex, aider, windsurf
  • Deployment — one-command VPS deploy via gofasta deploy
Last updated on