Skip to main content
The wrangler pages command provides tools for deploying and managing Cloudflare Pages projects.

pages deploy

Deploy a directory of static assets as a Pages deployment.
wrangler pages deploy [directory]
directory
string
The directory of static files to upload

Options

--project-name
string
The name of the project you want to deploy to
--branch
string
The name of the branch you want to deploy to
--commit-hash
string
The SHA to attach to this deployment
--commit-message
string
The commit message to attach to this deployment
--commit-dirty
boolean
Whether or not the workspace should be considered dirty for this deployment
--skip-caching
boolean
Skip asset caching which speeds up builds
--no-bundle
boolean
Whether to run bundling on _worker.js before deploying
--upload-source-maps
boolean
default:"false"
Whether to upload any server-side sourcemaps with this deployment

Example

# Deploy the current directory
wrangler pages deploy .

# Deploy a specific directory
wrangler pages deploy ./dist

# Deploy with specific project and branch
wrangler pages deploy ./public --project-name my-site --branch main

# Deploy with commit information
wrangler pages deploy ./build --commit-hash abc123 --commit-message "Update homepage"

pages dev

Develop your full-stack Pages application locally.
wrangler pages dev [directory] [-- command]
directory
string
The directory of static assets to serve
command
string
The proxy command to run (deprecated)

Options

--port
number
default:"8788"
The port to listen on (serve from)
--ip
string
The IP address to listen on
--inspector-port
number
Port for devtools to connect to
--compatibility-date
string
Date to use for compatibility checks
--compatibility-flags
string[]
Flags to use for compatibility checks
--no-bundle
boolean
Whether to run bundling on _worker.js
--live-reload
boolean
default:"false"
Auto reload HTML pages when change is detected
--local-protocol
'http' | 'https'
Protocol to listen to requests on, defaults to http
--https-key-path
string
Path to a custom certificate key
--https-cert-path
string
Path to a custom certificate
--persist-to
string
Specify directory to use for local persistence (defaults to .wrangler/state)
--log-level
'debug' | 'info' | 'log' | 'warn' | 'error' | 'none'
Specify logging level
--show-interactive-dev-session
boolean
Show interactive dev session (defaults to true if the terminal supports interactivity)

Binding Options

--binding
string[]
Bind variable/secret (KEY=VALUE)
--kv
string[]
KV namespace to bind (—kv KV_BINDING)
--d1
string[]
D1 database to bind (—d1 D1_BINDING)
--do
string[]
Durable Object to bind (—do DO_BINDING=CLASS_NAME@SCRIPT_NAME)
--r2
string[]
R2 bucket to bind (—r2 R2_BINDING)
--ai
string
AI to bind (—ai AI_BINDING)
--service
string[]
Service to bind (—service SERVICE=SCRIPT_NAME)

Example

# Serve static files from current directory
wrangler pages dev .

# Serve with specific port
wrangler pages dev ./public --port 3000

# Serve with bindings
wrangler pages dev . --kv MY_KV --d1 MY_DB

# Serve with live reload
wrangler pages dev ./dist --live-reload

pages project

Interact with your Pages projects.

pages project list

List your Cloudflare Pages projects.
wrangler pages project list
--json
boolean
default:"false"
Return output as clean JSON

pages project create

Create a new Cloudflare Pages project.
wrangler pages project create [project-name]
project-name
string
required
The name of your Pages project
--production-branch
string
The name of the production branch of your project
--compatibility-date
string
Date to use for compatibility checks
--compatibility-flags
string[]
Flags to use for compatibility checks

pages project delete

Delete a Cloudflare Pages project.
wrangler pages project delete [project-name]
project-name
string
required
The name of your Pages project
--yes
boolean
Answer “yes” to confirm project deletion

Example

# List all projects
wrangler pages project list

# Create a new project
wrangler pages project create my-site --production-branch main

# Delete a project
wrangler pages project delete my-site --yes

pages deployment

Interact with the deployments of a project.

pages deployment list

List deployments in your Cloudflare Pages project.
wrangler pages deployment list
--project-name
string
The name of the project you would like to list deployments for
--environment
'production' | 'preview'
Environment type to list deployments for
--json
boolean
default:"false"
Return output as clean JSON

pages deployment delete

Delete a deployment in your Cloudflare Pages project.
wrangler pages deployment delete [deployment-id]
deployment-id
string
required
The ID of the deployment to delete
--project-name
string
The name of the project the deployment belongs to
--force
boolean
default:"false"
Skip confirmation

pages deployment tail

Start a tail session for a deployment.
wrangler pages deployment tail
--project-name
string
The name of the project
--deployment-id
string
ID of the deployment to tail
--environment
'production' | 'preview'
Environment to tail (production or preview)

Example

# List all deployments
wrangler pages deployment list --project-name my-site

# List production deployments only
wrangler pages deployment list --environment production

# Delete a deployment
wrangler pages deployment delete abc123 --project-name my-site

# Tail deployment logs
wrangler pages deployment tail --project-name my-site --environment production

pages secret

Generate a secret that can be referenced in a Pages project.

pages secret put

Create or update a secret variable for a Pages project.
wrangler pages secret put <key>
key
string
required
The variable name to be accessible in the Pages project
--project-name
string
The name of your Pages project
--env
'production' | 'preview'
default:"production"
Environment to add the secret to

pages secret bulk

Bulk upload secrets for a Pages project.
wrangler pages secret bulk [file]
file
string
The file of key-value pairs to upload, as JSON or .env file. If omitted, Wrangler expects input from stdin
--project-name
string
The name of your Pages project
--env
'production' | 'preview'
default:"production"
Environment to add the secrets to

pages secret delete

Delete a secret from a Pages project.
wrangler pages secret delete <key>
key
string
required
The name of the secret to delete
--project-name
string
The name of your Pages project
--env
'production' | 'preview'
default:"production"
Environment to delete the secret from

pages secret list

List all secrets for a Pages project.
wrangler pages secret list
--project-name
string
The name of your Pages project
--env
'production' | 'preview'
default:"production"
Environment to list secrets for

Example

# Add a secret (interactive prompt for value)
wrangler pages secret put API_KEY --project-name my-site

# Add a secret from stdin
echo "secret-value" | wrangler pages secret put API_KEY

# Bulk upload from JSON file
wrangler pages secret bulk secrets.json --project-name my-site

# Bulk upload from .env file
wrangler pages secret bulk .env.production --env production

# List all secrets
wrangler pages secret list --project-name my-site

# Delete a secret
wrangler pages secret delete API_KEY --project-name my-site

pages download

Download settings from your project.

pages download config

Download configuration from your Pages project.
wrangler pages download config [project-name]
project-name
string
The name of your Pages project
--outdir
string
default:"."
Output directory for the downloaded configuration

Example

# Download config for a project
wrangler pages download config my-site

# Download to specific directory
wrangler pages download config my-site --outdir ./config

Complete Workflow Example

1

Create a new Pages project

wrangler pages project create my-awesome-site --production-branch main
2

Set up secrets for your project

# Add individual secrets
wrangler pages secret put API_KEY --project-name my-awesome-site

# Or bulk upload from a file
wrangler pages secret bulk .env.production --project-name my-awesome-site
3

Develop locally

# Start local development server
wrangler pages dev ./public --port 8788 --live-reload
4

Deploy to production

# Build your site first (example with a build command)
npm run build

# Deploy the built assets
wrangler pages deploy ./dist --project-name my-awesome-site --branch main
5

Monitor your deployment

# List deployments
wrangler pages deployment list --project-name my-awesome-site

# Tail logs for production
wrangler pages deployment tail --project-name my-awesome-site --environment production

Build docs developers (and LLMs) love