Quick Start
Five minutes, four commands, a working backend with REST + database + hot reload + observability + interactive controls.
Step 1: Create a Project
gofasta new myappOr with a full Go module path:
gofasta new github.com/myorg/myappThis scaffolds a REST-only project. Add --graphql if you want gqlgen + a /graphql endpoint + playground generated alongside REST:
gofasta new myapp --graphqlThe 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 devThat 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:
| Stage | What runs |
|---|---|
| 1. Preflight | Verifies docker and docker compose are available. |
| 2. Service start | docker compose up -d with the cache + queue profiles auto-activated. db, redis, and asynqmon come up together. |
| 3. Health-wait | Polls each service’s compose healthcheck until ready (30s timeout). |
| 4. Migrate | Runs migrate up against the now-healthy database. |
| 5. Air | Execs go tool air against .air.toml — your code rebuilds on every save. |
| 6. Teardown | On Ctrl+C, stops services (volumes preserved so the next run reuses your data). |
Your app is live at:
| Endpoint | URL |
|---|---|
| REST API | http://localhost:8080/api/v1/ |
| Health check | http://localhost:8080/health |
| Prometheus metrics | http://localhost:8080/metrics |
| Swagger UI | http://localhost:8080/swagger/index.html (after gofasta swagger) |
If you scaffolded with --graphql:
| Endpoint | URL |
|---|---|
| GraphQL | http://localhost:8080/graphql |
| GraphQL Playground | http://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| Key | Action |
|---|---|
r / R | Restart 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 / Q | Quit 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
| Flag | What it does |
|---|---|
gofasta dev --dry-run | Print what would run, exit. Great in CI to validate compose + config without spinning anything up. |
gofasta dev --fresh | Drop every compose volume before starting. Clean slate database. |
gofasta dev --seed | Run seeders after migrations. |
gofasta dev --no-cache | Skip the cache (Redis). Use when you don’t need it. |
gofasta dev --no-queue | Skip the queue dashboard. |
gofasta dev --no-services | Skip compose entirely. Air only — use when you bring your own database. |
gofasta dev --all-in-docker | Run 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 --dashboard | Spin 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-logs | Stream docker compose logs -f alongside Air output. |
gofasta dev --json | NDJSON 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:floatThis generates 11 files and patches 4 existing files in one shot:
| Generated file | What it is |
|---|---|
app/models/product.model.go | Database model |
db/migrations/000006_create_products.up.sql | Create table migration |
db/migrations/000006_create_products.down.sql | Drop table migration |
app/repositories/interfaces/product_repository.go | Repository interface |
app/repositories/product.repository.go | Repository implementation (GORM) |
app/services/interfaces/product_service.go | Service interface |
app/services/product.service.go | Service implementation |
app/dtos/product.dtos.go | Request/response DTOs with validation |
app/di/providers/product.go | Wire DI provider |
app/rest/controllers/product.controller.go | REST controller |
app/rest/routes/product.routes.go | Route definitions (GET, POST, PUT, DELETE) |
Plus automatic patches to wire everything in:
app/di/container.go—ProductService+ProductControllerfieldsapp/di/wire.go—ProductSetadded to the Wire buildapp/rest/routes/index.routes.go—/api/v1/productsregisteredcmd/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
.gosaves automatically. You only needrfor things outside Air’s watch — migrations, config changes,.envedits.
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
| Type | Go type | SQL type (Postgres) | GraphQL type |
|---|---|---|---|
string | string | VARCHAR(255) | String |
text | string | TEXT | String |
int | int | INTEGER | Int |
float | float64 | DECIMAL(10,2) | Float |
bool | bool | BOOLEAN | Boolean |
uuid | uuid.UUID | UUID | ID |
time | time.Time | TIMESTAMP | DateTime |
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
- Configuration —
config.yamlschema, env-var overrides, multi-database support - Authentication — JWT + Casbin RBAC, scaffolded auth flows
- Agent integrations —
gofasta ai claude,cursor,codex,aider,windsurf - Deployment — one-command VPS deploy via
gofasta deploy