Skip to content

CLI Overview

The cruz CLI is a unified command-line tool for CruzJS development and deployment. It wraps Vite, Drizzle Kit, Wrangler, Vitest, and Playwright into a single interface, so you do not need to learn or configure each tool separately.

The CLI is built with React Ink, rendering interactive terminal UI with spinners, prompts, and colored output.

The CLI is installed as a dev dependency when you scaffold a new project:

Terminal window
npx create-cruz-app my-app
cd my-app
npm install

It is available as cruz in your terminal (via npx or your package manager’s bin path):

Terminal window
cruz --help

If you need to install it separately:

Terminal window
npm install -D @cruzjs/cli

The CLI organizes commands into five groups:

Start, build, test, and type-check your application locally.

CommandDescription
cruz devStart local dev server (runs in background)
cruz dev stopStop the dev server
cruz dev restartRestart the dev server
cruz dev statusCheck if the dev server is running
cruz buildProduction build (React Router + Vite)
cruz startStart the production server locally
cruz testRun unit tests with Vitest
cruz test:e2eRun E2E tests with Playwright
cruz typecheckRun TypeScript type checking

Manage your Drizzle ORM schema and Cloudflare D1 database.

CommandDescription
cruz db generateGenerate migration files from schema changes
cruz db migrateApply migrations to local D1
cruz db migrate --remoteApply migrations to remote (production) D1
cruz db query "SQL"Execute raw SQL against local D1
cruz db studioOpen Drizzle Studio for visual database browsing
cruz db seedRun the database seed script
cruz db hard-resetDelete local D1 data and start fresh

Generate new standalone Cloudflare Workers, Workflows, and queue consumers.

CommandDescription
cruz new worker <name>Scaffold a standalone Cloudflare Worker
cruz new workflow <name>Scaffold a durable Workflow with retryable steps
cruz new queue-worker <name> --queue <q>Scaffold a queue consumer Worker

Build, migrate, and ship your application to Cloudflare.

CommandDescription
cruz init <env>Initialize a new environment (creates D1, KV, R2 resources)
cruz deploy <env>Full deployment: build + migrate + deploy
cruz deploy previewPreview deployment from the current git branch
cruz statusShow all configured environments and their state
cruz destroy <env>Tear down an environment and its resources

Manage Cloudflare infrastructure resources.

CommandDescription
cruz queue create/list/deleteManage Cloudflare Queues
cruz secrets set/listManage environment secrets
cruz kv create/listManage KV namespaces
cruz r2 create/listManage R2 storage buckets

These flags can be used with most commands:

FlagDescription
-e, --env <name>Target a specific environment
-y, --yesAuto-confirm prompts (non-interactive mode)
--remoteTarget the remote D1 database instead of local
--skip-buildSkip the build step during deployment
--skip-migrateSkip migrations during deployment
--forceAllow destructive operations (e.g., destroying production)

Run any command with --help or run cruz with no arguments to see the full help screen:

Terminal window
cruz --help
cruz deploy --help

The CLI reads configuration from two sources:

  • cruz.config.ts — Defines your project name, Cloudflare bindings, and environment variables. Lives in the project root.
  • .cruz.json — Auto-generated file that stores environment state (D1 database IDs, KV namespace IDs, deployment timestamps). Managed by the CLI.