Pages
Configure Cloudflare Pages using Wrangler.
Develop your full-stack Pages application locally
npx wrangler pages dev [DIRECTORY] [COMMAND]pnpm wrangler pages dev [DIRECTORY] [COMMAND]yarn wrangler pages dev [DIRECTORY] [COMMAND]-
[DIRECTORY]stringThe directory of static assets to serve
-
[COMMAND]stringThe proxy command to run [deprecated]
-
--compatibility-datestringDate to use for compatibility checks
-
--compatibility-flagsstringalias: --compatibility-flagFlags to use for compatibility checks
-
--ipstringThe IP address to listen on
-
--portnumberThe port to listen on (serve from)
-
--inspector-portnumberPort for devtools to connect to
-
--proxynumberThe port to proxy (where the static assets are served)
-
--script-pathstringThe location of the single Worker script if not using functions [default: _worker.js]
-
--no-bundlebooleanWhether to run bundling on
_worker.js -
--bindingarrayalias: --bBind variable/secret (KEY=VALUE)
-
--kvarrayalias: --kKV namespace to bind (--kv KV_BINDING)
-
--d1arrayD1 database to bind (--d1 D1_BINDING)
-
--doarrayalias: --oDurable Object to bind (--do DO_BINDING=CLASS_NAME@SCRIPT_NAME)
-
--r2arrayR2 bucket to bind (--r2 R2_BINDING)
-
--aistringAI to bind (--ai AI_BINDING)
-
--version-metadatastringWorker Version metadata (--version-metadata VERSION_METADATA_BINDING)
-
--servicearrayService to bind (--service SERVICE=SCRIPT_NAME)
-
--live-reloadbooleandefault: falseAuto reload HTML pages when change is detected
-
--local-protocol"http" | "https"Protocol to listen to requests on, defaults to http.
-
--https-key-pathstringPath to a custom certificate key
-
--https-cert-pathstringPath to a custom certificate
-
--persist-tostringSpecify directory to use for local persistence (defaults to .wrangler/state)
-
--log-level"debug" | "info" | "log" | "warn" | "error" | "none"Specify logging level
-
--show-interactive-dev-sessionbooleanShow interactive dev session (defaults to true if the terminal supports interactivity)
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Compile a folder of Pages Functions into a single Worker
npx wrangler pages functions build [DIRECTORY]pnpm wrangler pages functions build [DIRECTORY]yarn wrangler pages functions build [DIRECTORY]-
[DIRECTORY]stringdefault: functionsThe directory of Pages Functions
-
--outfilestringThe location of the output Worker script
-
--outdirstringOutput directory for the bundled Worker
-
--output-config-pathstringThe location for the output config file
-
--build-metadata-pathstringThe location for the build metadata file
-
--project-directorystringThe location of the Pages project
-
--output-routes-pathstringThe location for the output _routes.json file
-
--minifybooleandefault: falseMinify the output Worker script
-
--sourcemapbooleandefault: falseGenerate a sourcemap for the output Worker script
-
--fallback-servicestringdefault: ASSETSThe service to fallback to at the end of the
nextchain. Setting to '' will fallback to the globalfetch. -
--watchbooleandefault: falseWatch for changes to the functions and automatically rebuild the Worker script
-
--pluginbooleandefault: falseBuild a plugin rather than a Worker script
-
--build-output-directorystringThe directory to output static assets to
-
--compatibility-datestringDate to use for compatibility checks
-
--compatibility-flagsstringalias: --compatibility-flagFlags to use for compatibility checks
-
--externalstringA list of module imports to exclude from bundling
-
--metafilestringPath to output build metadata from esbuild. If flag is used without a path, defaults to 'bundle-meta.json' inside the directory specified by --outdir.
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
List your Cloudflare Pages projects
npx wrangler pages project listpnpm wrangler pages project listyarn wrangler pages project list-
--jsonbooleandefault: falseReturn output as JSON
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Create a new Cloudflare Pages project
npx wrangler pages project create [PROJECT-NAME]pnpm wrangler pages project create [PROJECT-NAME]yarn wrangler pages project create [PROJECT-NAME]-
[PROJECT-NAME]stringrequiredThe name of your Pages project
-
--production-branchstringThe name of the production branch of your project
-
--compatibility-flagsstringalias: --compatibility-flagFlags to use for compatibility checks
-
--compatibility-datestringDate to use for compatibility checks
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Delete a Cloudflare Pages project
npx wrangler pages project delete [PROJECT-NAME]pnpm wrangler pages project delete [PROJECT-NAME]yarn wrangler pages project delete [PROJECT-NAME]-
[PROJECT-NAME]stringrequiredThe name of your Pages project
-
--yesbooleanalias: --yAnswer "yes" to confirm project deletion
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
List deployments in your Cloudflare Pages project
npx wrangler pages deployment listpnpm wrangler pages deployment listyarn wrangler pages deployment list-
--project-namestringThe name of the project you would like to list deployments for
-
--environmentstringEnvironment type to list deployments for
-
--jsonbooleandefault: falseReturn output as JSON
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Start a tailing session for a project's deployment and livestream logs from your Functions
npx wrangler pages deployment tail [DEPLOYMENT]pnpm wrangler pages deployment tail [DEPLOYMENT]yarn wrangler pages deployment tail [DEPLOYMENT]-
[DEPLOYMENT]string(Optional) ID or URL of the deployment to tail. Specify by environment if deployment ID is unknown.
-
--project-namestringThe name of the project you would like to tail
-
--environmentstringdefault: productionWhen not providing a specific deployment ID, specifying environment will grab the latest production or preview deployment
-
--formatstringThe format of log entries
-
--status"ok" | "error" | "canceled"Filter by invocation status
-
--headerstringFilter by HTTP header
-
--methodstringFilter by HTTP method
-
--searchstringFilter by a text match in console.log messages
-
--sampling-ratenumberAdds a percentage of requests to log sampling rate
-
--ipstringFilter by the IP address the request originates from. Use "self" to filter for your own IP
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Delete a deployment in your Cloudflare Pages project
npx wrangler pages deployment delete [DEPLOYMENT-ID]pnpm wrangler pages deployment delete [DEPLOYMENT-ID]yarn wrangler pages deployment delete [DEPLOYMENT-ID]-
[DEPLOYMENT-ID]stringrequiredThe ID of the deployment to delete
-
--project-namestringThe name of the project the deployment belongs to
-
--forcebooleanalias: --f default: falseDelete even if the deployment has an active alias
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Deploy a directory of static assets as a Pages deployment
npx wrangler pages deploy [DIRECTORY]pnpm wrangler pages deploy [DIRECTORY]yarn wrangler pages deploy [DIRECTORY]-
[DIRECTORY]stringThe directory of static files to upload
-
--project-namestringThe name of the project you want to deploy to
-
--branchstringThe name of the branch you want to deploy to
-
--commit-hashstringThe SHA to attach to this deployment
-
--commit-messagestringThe commit message to attach to this deployment
-
--commit-dirtybooleanWhether or not the workspace should be considered dirty for this deployment
-
--skip-cachingbooleanSkip asset caching which speeds up builds
-
--no-bundlebooleanWhether to run bundling on
_worker.jsbefore deploying -
--upload-source-mapsbooleandefault: falseWhether to upload any server-side sourcemaps with this deployment
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Create or update a secret variable for a Pages project
npx wrangler pages secret put [KEY]pnpm wrangler pages secret put [KEY]yarn wrangler pages secret put [KEY]-
[KEY]stringrequiredThe variable name to be accessible in the Pages project
-
--project-namestringaliases: --projectThe name of your Pages project
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Bulk upload secrets for a Pages project
npx wrangler pages secret bulk [FILE]pnpm wrangler pages secret bulk [FILE]yarn wrangler pages secret bulk [FILE]-
[FILE]stringThe file of key-value pairs to upload, as JSON in form {"key": value, ...} or .dev.vars file in the form KEY=VALUE
-
--project-namestringaliases: --projectThe name of your Pages project
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Delete a secret variable from a Pages project
npx wrangler pages secret delete [KEY]pnpm wrangler pages secret delete [KEY]yarn wrangler pages secret delete [KEY]-
[KEY]stringrequiredThe variable name to be accessible in the Pages project
-
--project-namestringaliases: --projectThe name of your Pages project
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
List all secrets for a Pages project
npx wrangler pages secret listpnpm wrangler pages secret listyarn wrangler pages secret list-
--project-namestringaliases: --projectThe name of your Pages project
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation
Experimental
Download your Pages project config as a Wrangler configuration file
npx wrangler pages download config [PROJECTNAME]pnpm wrangler pages download config [PROJECTNAME]yarn wrangler pages download config [PROJECTNAME]-
[PROJECTNAME]stringThe Pages project to download
-
--forcebooleanOverwrite an existing Wrangler configuration file without prompting
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
-
--install-skillsbooleandefault: falseInstall Cloudflare agents skills, if not already present, without asking the user for confirmation