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/schema-auth.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
# Email:    [email protected]
# User ID:  user_...
# Platform: https://gencow.app
# Token:    gk_1234567...abcd
# Expires:  ...

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 on Startup / Enterprise. 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 (Startup / Enterprise)
gencow deploy --prod --region kr # First production app placement region
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 (Startup / Enterprise)
--region <slug> First production app placement region. Existing prod apps are not moved; unavailable regions fail closed.
--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 (Startup / Enterprise)
gencow env set KEY=VALUE     # Set dev env var (hot-reload, no restart)
gencow env set KEY=VALUE --prod  # Set prod env var (Startup / Enterprise)
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 origins

Inspect the effective public origins used by API CORS and auth/OAuth flows.

gencow origins list                         # Show managed + code-declared origins
gencow origins check https://myapp.vercel.app
gencow origins list --prod                  # Production app (Startup / Enterprise)

Declare external frontend origins in gencow.config.js, then redeploy:

export default {
  frontendOrigins: ["https://myapp.vercel.app"],
};

gencow cors (legacy)

Inspect legacy cloud CORS overrides. Prefer gencow origins plus frontendOrigins for new apps.

gencow cors list                          # Show auto + custom origins
gencow origins check https://myapp.vercel.app
gencow cors list --prod                   # Production app (Startup / Enterprise)

*.gencow.app and localhost:* are allowed automatically. Custom domains connected with gencow domain set are same-origin, so they do not need app config. Legacy add/remove commands remain for old stored overrides but should not be used for new public origins.

gencow files

Manage uploaded files in your app's storage.

gencow files upload <path...>                 # Upload private files
gencow files upload hero.png --public         # Upload a public website asset
gencow files upload dir/ -r                   # Upload directory recursively
gencow files list                             # List uploaded files and visibility
gencow files visibility <storage_id> public   # Make a file public
gencow files visibility <storage_id> private  # Make a file private
gencow files delete <storage_id>              # Delete a file
gencow files url <storage_id>                 # Get public URL or short-lived private grant URL
Flag Description
--recursive, -r Upload directory contents recursively
--public Upload files as public assets. Without this flag, files are private
--app, -a <name> Target specific app (default: from gencow.json)
--prod Target production app
--yes, -y Skip delete confirmation

Hosted storage is private by default. Use public visibility only for assets that anyone with the URL may read; private files are shown through short-lived read grant URLs.

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. Custom domain set/rebind is available on Startup and Enterprise plans. Hobby users can still check or remove an existing domain.

gencow domain set www.myapp.com          # Connect a www custom domain to dev app
gencow domain set www.myapp.com --prod   # Connect a www custom domain to production app
gencow domain set myapp.com --prod       # Connect apex domain with ALIAS/ANAME/CNAME flattening
gencow domain set myapp.com --prod --dry-run
gencow domain set myapp.com --prod --yes
gencow domain status                 # Check dev DNS/TLS status
gencow domain status --prod          # Check production DNS/TLS status
gencow domain remove                 # Disconnect dev domain
gencow domain remove --prod          # Disconnect production domain

www.* domains use a CNAME to the selected app target and remain canonical when connected directly. Apex domains need provider-supported ALIAS/ANAME/CNAME flattening, or the stable edge IP fallback printed by gencow domain set/status.

Flag Description
--prod Target production app from gencow.json.prodApp
--app, -a <name> Target specific app
--dry-run Preview target, DNS guidance, and rebind requirements without writing
--yes Confirm non-interactive rebinds for scripts/CI

Without --prod, domain commands target the dev app. Use --prod when the public domain should serve the production app listed in gencow.json as prodApp. If the same domain is already connected to the related dev app, preview with --dry-run and apply the move with --yes.

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

memory_exceeded apps are shown as memory exceeded. gencow app status <name> includes the status reason, recent OOM count, last OOM time, and recovery guidance.

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

# Domains
gencow domain set myapp.com --prod
gencow domain status --prod
gencow domain remove --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