Skip to content

Cloudflare Pages CLI

Use Direct Upload: build locally with bun, then push the prebuilt dist/ folder with the Wrangler CLI — no Git integration required.

security-docs/
├── bun run build → dist/
└── bunx wrangler pages deploy dist → https://<project>.pages.dev
Terminal window
bunx wrangler login

For CI / non-interactive use, set these env vars instead:

Terminal window
export CLOUDFLARE_ACCOUNT_ID="<ACCOUNT_ID>"
export CLOUDFLARE_API_TOKEN="<API_TOKEN>"
Terminal window
bunx wrangler pages project create

Prompts for a project name (→ <NAME>.pages.dev) and production branch, then caches both.

Terminal window
bun run build
bunx wrangler pages deploy dist

The first pages deploy can also create the project and deploy in one step.

Terminal window
bunx wrangler pages deploy dist --branch=staging
# → https://staging.<project>.pages.dev
Task Command
Log in bunx wrangler login
Create project bunx wrangler pages project create
Deploy production bunx wrangler pages deploy dist
Deploy preview bunx wrangler pages deploy dist --branch=staging
List projects bunx wrangler pages project list
List deployments bunx wrangler pages deployment list
Item Limit / note
Files per deploy 20,000
Max file size 25 MiB
ZIP uploads Not supported via Wrangler
Switching to Git integration Not possible later — recreate the project