CLI Reference

Complete Gencow CLI command reference — all commands, flags, and environment variables

Quick Start

gencow <command> [options]

Project Commands

gencow init

Create a new Gencow project, install dependencies, and run codegen (including gencow/generated/auth-schema.ts and gencow/generated/db-schema.gen.ts).

gencow init my-app
gencow init .                    # current directory
gencow init my-app -t fullstack  # with template
gencow init . --force            # non-empty directory
Flag Description
--template, -t Template: default, task-app, fullstack, ai-chat
--force, -f Initialize in a non-empty directory. Preserves non-Gencow files and merges package.json, but may overwrite Gencow scaffold files

Use gencow init . --force to add Gencow to an existing non-Gencow project. Do not run it inside a project cloned from gencow templates clone; cloned templates already include their backend and config files.

gencow add

Add AI components to your project.

gencow add AI
gencow add sso
gencow add AI RAG Reranker
gencow add Guardrails Prompts

Available components: AI, SSO, Tools, RAG, Reranker, Guardrails, Prompts, Parsers, Memory, Analytics

Dependencies are auto-resolved (e.g., gencow add RAG also installs AI). gencow add sso currently generates Google login only, backed by Better Auth socialProviders.google. gencow add SSO and legacy gencow add OAuth are accepted as aliases, but docs and CLI output use lowercase gencow add sso.

gencow codegen

Generate frontend API client without starting the dev server.

gencow codegen
gencow codegen --outdir src/gencow/
Flag Description
--outdir, -o Output directory (default: src/gencow/)

Commands (Login Required)

gencow templates

Browse, clone, download, and publish marketplace templates.

gencow templates list
gencow templates info <slug>
gencow templates clone <slug> [dir]
gencow templates clone <slug> [dir] --version <version>
gencow templates download <slug> --out template.tar.gz
gencow templates publish --title "CRM Starter" --price 29

clone extracts the template source into a new local directory. After cloning, install dependencies, log in, and deploy from the cloned project:

cd my-app
bun install
gencow login
gencow deploy

For fullstack templates with a built frontend:

bun run build
gencow deploy --static dist/

Template clone does not include gencow.json, .env, .gencow/, platform tokens, or preview app bindings. The first deploy creates a new app ID for your account.

gencow login

Authenticate via browser (Device Auth flow).

gencow login
# → Opens browser for authentication
# → Saves token to ~/.gencow/credentials.json

gencow logout

Clear saved credentials.

gencow logout

gencow whoami

Show current user info and token status.

gencow whoami

gencow dev

Start cloud development with hot-reload. Watches for file changes, auto-deploys to cloud, and streams live logs.

gencow dev             # Cloud development (default)
gencow dev --verbose   # Show all HTTP logs
Flag Description
--verbose Show admin/ws/auth HTTP logs (normally suppressed)

What it does:

  • Auto-deploys code to Gencow Cloud on file changes
  • Streams live server logs to your terminal
  • Auto-generates gencow/api.ts and gencow/README.md
  • Syncs schema with database via auto-migration

gencow db:push

Sync schema.ts → database instantly (no migration files).

gencow db:push           # Push to dev cloud DB (default)
gencow db:push --prod    # Push to production DB (confirmation required)
Flag Description
--prod Push to production database. Requires confirmation prompt for safety

gencow db:generate

Generate SQL migration files from schema.ts changes. Runs automatically before gencow deploy — only needed if you want to preview or commit migrations separately.

gencow db:generate
# → Creates files in gencow/migrations/

gencow db:seed

Run gencow/seed.ts to insert test data.

gencow db:seed           # Seed dev cloud app (default)
gencow db:seed --prod    # Seed production app
Flag Description
--prod Seed production app

gencow static

Deploy static frontend files only (dist/, out/, build/).

gencow static              # Auto-detects dist/out/build/ → deploy to dev
gencow static dist/        # Specify static directory
gencow static --prod       # Deploy to production app
gencow static --app my-app dist/ # Target a specific app
Flag Description
--prod Deploy to production app
--app, -a <name> Target specific app (default: from current or parent backend gencow.json)
--force, -f Skip dependency audit

When run from a frontend subdirectory, gencow static detects the parent backend root for app metadata. The static directory is still resolved relative to the frontend working directory.

gencow deploy

Deploy backend to cloud. Defaults to dev environment. Use --prod for production (Pro+ only). Automatically runs drizzle-kit generate before bundling.

gencow deploy                # Deploy backend to dev
gencow deploy --static dist/ # Deploy backend, then static files
gencow deploy --prod         # Deploy backend to production (Pro+)
gencow deploy --rollback     # Roll back dev deployment
gencow deploy --rollback --prod  # Roll back production deployment
gencow deploy logs           # Follow server logs
gencow deploy status         # App status
Flag Description
--prod Deploy to production app (Pro+ only)
--static [dir] Deploy backend first, then static files from dir
--app, -a <name> Target specific app
--rollback Roll back to previous deployment (code only, no DB rollback)
--force, -f Skip dependency audit
--yes Skip confirmation prompts (for CI/CD)

Hobby plan: gencow deploy --prod is blocked for Hobby users. gencow deploy (dev) is available to all plans.

Auto-migration: Both gencow dev and gencow deploy automatically run npx drizzle-kit generate before bundling. Interactive prompts (e.g., column renames) pass through to your terminal.

gencow env

Manage environment variables on your cloud app. For local development, use .env file directly.

gencow env list              # List dev app env vars
gencow env list --prod       # List prod app env vars (Pro+)
gencow env set KEY=VALUE     # Set dev env var (hot-reload, no restart)
gencow env set KEY=VALUE --prod  # Set prod env var (Pro+)
gencow env unset KEY         # Remove env var
gencow env push              # Push .env to dev app
gencow env push --prod       # Push .env.production to prod app

⚡ Changes apply instantly — no app restart needed.

gencow cors

Manage browser CORS origins for frontends hosted outside Gencow.

gencow cors list                          # Show auto + custom origins
gencow cors add https://myapp.vercel.app  # Allow external frontend origin
gencow cors remove https://myapp.vercel.app
gencow cors list --prod                   # Production app (Pro+)

*.gencow.app and localhost:* are allowed automatically. Custom domains connected with gencow domain set are same-origin, so they do not need CORS entries. If the app is idle, CORS changes are saved immediately and applied on the next wake.

gencow files

Manage uploaded files in your app's storage.

gencow files upload <path...>     # Upload files
gencow files upload dir/ -r       # Upload directory recursively
gencow files list                 # List uploaded files
gencow files delete <storage_id>  # Delete a file
gencow files url <storage_id>     # Get serving URL
Flag Description
--recursive, -r Upload directory contents recursively
--app, -a <name> Target specific app (default: from gencow.json)
--prod Target production app
--yes, -y Skip delete confirmation

gencow config

Manage app image processing configuration.

gencow config set image.maxWidth 1200   # Set Auto WebP max width (px, 0-10000)
gencow config set image.quality 85      # Set Auto WebP quality (0-100)
gencow config get                       # Show current image config
gencow config reset                     # Reset to tier defaults
Flag Description
--app, -a <name> Target specific app (default: from gencow.json)
--prod Target production app

gencow domain

Manage custom domains.

gencow domain set myapp.com   # Connect custom domain
gencow domain status          # Check DNS/TLS status
gencow domain remove          # Disconnect domain

gencow app

Manage your cloud apps.

gencow app list          # List all your apps
gencow app create <name> # Create a new app
gencow app delete <name> # Delete an app (confirmation required)
gencow app status        # Show current app status

The --prod Flag

Most cloud commands support --prod to target the production app instead of the dev app. This reads the prodApp field from gencow.json.

# Database
gencow db:push --prod
gencow db:seed --prod

# Static deploy
gencow static --prod

# Environment
gencow env list --prod
gencow env set KEY=VALUE --prod
gencow env push --prod

# Files & Config
gencow files list --prod
gencow config get --prod

Production apps are created automatically when you first run gencow deploy --prod.

Environment Variables

Variable Description
GENCOW_TOKEN Deploy token for CI/CD (bypasses gencow login)
GENCOW_PLATFORM_URL Platform URL (default: https://gencow.app)
DATABASE_URL PostgreSQL connection URL (production)
GENCOW_INTERNAL_URL Auto-injected server URL for self-fetch

Next Steps