CLI Commands

Command table

CommandDescription
gofire new <name>Create new project from scratch (directory, go.mod, api.yaml, handlers, server). Use when starting with no project.
gofire initCreate api.yaml and cmd/server/main.go in existing project. Use when you already have go.mod.
gofire setupInteractive config (port, Firebase, Redis). Optionally save to .env and create .gofire.yaml with output paths.
gofire add endpoint "METHOD /path" [--auth]Add endpoint to api.yaml
gofire gen [--server-dir DIR] [--handlers-dir DIR] [--handlers-only]Generate handlers and server. Server loads api.yaml at runtime. Use --handlers-only to generate only handlers (no server).
gofire listList all endpoints from api.yaml
gofire deployInteractive Vercel deploy (preview or production)

--handlers-only

Generate only handler files; do not touch server/server.go. Useful when you have a custom server that reads api.yaml at runtime or uses a different routing setup.

gofire gen --handlers-only

Custom output paths

Define paths once so you don't repeat --server-dir / --handlers-dir. Add to .gofire.yaml (project root) or api.yaml:

output:
  serverDir: pkg/server
  handlersDir: pkg/handler

Resolution order: CLI flags > .gofire.yaml > api.yaml output > default.

new vs init

gofire new — Start from scratch. Creates directory, go.mod, go get, api.yaml, handlers, server, .gitignore. One command, ready to run.

gofire init — Add GoFire to existing project. Requires go.mod in current directory. Creates api.yaml and cmd/server/main.go. Run gofire gen after to generate handlers and server.

Examples

gofire add endpoint "GET /users"
gofire add endpoint "POST /users" --auth
gofire add endpoint "GET /users/:id" --auth

--auth must be outside the quotes (e.g. "POST /users" --auth).