Skip to content

CLI Reference

The Cloudwerk CLI provides commands for development, building, and deployment.

The CLI is included with @cloudwerk/cli:

Terminal window
pnpm add -D @cloudwerk/cli

Start the development server with hot reload.

Terminal window
cloudwerk dev [path] [options]

Options:

OptionDescriptionDefault
--port, -pPort number8787
--host, -HHost to bindlocalhost
--config, -cPath to config fileAuto-detected
--verboseEnable verbose loggingfalse

Examples:

Terminal window
# Start dev server
cloudwerk dev
# Custom port
cloudwerk dev --port 3000
# All interfaces
cloudwerk dev --host 0.0.0.0
# With custom config
cloudwerk dev --config cloudwerk.staging.ts

Build the application for production.

Terminal window
cloudwerk build [path] [options]

Options:

OptionDescriptionDefault
--output, -oOutput directory./dist
--ssgGenerate static pages for rendering: static routesfalse
--minifyMinify bundlestrue
--no-minifyDisable minification-
--sourcemapGenerate source mapsfalse
--config, -cPath to config fileAuto-detected
--verboseEnable verbose loggingfalse

Examples:

Terminal window
# Production build
cloudwerk build
# With bundle analysis
cloudwerk build --sourcemap
# Development build
cloudwerk build --no-minify
# Static site generation
cloudwerk build --ssg

Deploy to Cloudflare Workers.

Terminal window
cloudwerk deploy [path] [options]

Options:

OptionDescriptionDefault
--env, -eEnvironment to deploy to-
--dry-runPreview without deployingfalse
--skip-buildSkip the build stepfalse
--config, -cPath to config fileAuto-detected
--verboseEnable verbose loggingfalse

Examples:

Terminal window
# Deploy to production
cloudwerk deploy
# Deploy to staging
cloudwerk deploy --env staging
# Preview deployment
cloudwerk deploy --dry-run

Manage Cloudwerk configuration.

Terminal window
cloudwerk config <command> [options]

Subcommands:

CommandDescription
get <key>Get a configuration value
set <key> <value>Set a configuration value

Examples:

Terminal window
# Get config value
cloudwerk config get appDir
# Set config value
cloudwerk config set dev.port 3000

Manage Cloudflare bindings (D1, KV, R2, Queues, etc.).

Terminal window
cloudwerk bindings [options]
cloudwerk bindings <command> [options]

Running without a subcommand shows an overview of all configured bindings.

Subcommands:

CommandDescription
add [type]Add a new binding (d1, kv, r2, queue, do, secret)
remove [name]Remove a binding
update [name]Update an existing binding
generate-typesRegenerate TypeScript type definitions

Examples:

Terminal window
# Show bindings overview
cloudwerk bindings
# Add D1 database
cloudwerk bindings add d1
# Add KV namespace
cloudwerk bindings add kv
# Remove a binding
cloudwerk bindings remove --force
# Regenerate types
cloudwerk bindings generate-types

Manage Cloudwerk triggers (scheduled, queue, R2, webhook, etc.).

Terminal window
cloudwerk triggers [options]
cloudwerk triggers <command> [options]

Running without a subcommand shows an overview of all triggers.

Subcommands:

CommandDescription
listList all triggers with details
validateValidate trigger configurations
generateRegenerate wrangler.toml and TypeScript types

Examples:

Terminal window
# Show triggers overview
cloudwerk triggers
# List all triggers
cloudwerk triggers list
# Filter by type
cloudwerk triggers list --type scheduled
# Validate configs
cloudwerk triggers validate --strict
# Regenerate config
cloudwerk triggers generate
# Output as JSON
cloudwerk triggers list --json

Manage Cloudwerk Durable Objects.

Terminal window
cloudwerk objects [options]
cloudwerk objects <command> [options]

Running without a subcommand shows an overview of all durable objects.

Subcommands:

CommandDescription
listList all durable objects with details
info <name>Show durable object details
migrationsShow migration history for SQLite durable objects
generateRegenerate wrangler.toml and TypeScript types

Examples:

Terminal window
# Show objects overview
cloudwerk objects
# List all durable objects
cloudwerk objects list
# Show details for specific object
cloudwerk objects info Counter
# View migrations
cloudwerk objects migrations
# Regenerate config
cloudwerk objects generate

Manage Cloudwerk services (RPC bindings).

Terminal window
cloudwerk services [options]
cloudwerk services <command> [options]

Running without a subcommand shows an overview of all services.

Subcommands:

CommandDescription
listList all services with details
info <name>Show service details
extract <name>Extract service to separate Worker
inline <name>Convert extracted service back to local mode
deploy <name>Deploy extracted service
statusShow status of all services

Examples:

Terminal window
# Show services overview
cloudwerk services
# List all services
cloudwerk services list
# Show details for specific service
cloudwerk services info email
# Extract service to separate Worker
cloudwerk services extract payments
# Convert back to local mode
cloudwerk services inline payments
# Deploy extracted service
cloudwerk services deploy payments --env staging
# Show all services status
cloudwerk services status

These options work with all commands:

OptionDescription
--config, -cConfig file path
--help, -hShow help
--version, -vShow version
--verboseVerbose output

Commands read from cloudwerk.config.ts by default. Override with --config:

Terminal window
cloudwerk dev --config cloudwerk.production.ts
CodeDescription
0Success
1General error
2Configuration error
3Build error
4Deployment error