One-command deploys to Cloudflare Pages
How this site goes from a folder on my Mac to chotigold.in in under ten seconds using wrangler's direct-upload mode — no Git integration required.
Cloudflare Pages is usually pitched as "connect your Git repo and we'll build it". That's fine, but it's not the only way in. Pages also accepts a direct upload: hand it a folder, and it becomes the live site. For a static site that's already built locally, this is the simplest deploy path I know of.
The setup
You need wrangler (Cloudflare's CLI) and a one-time login:
npm install --save-dev wrangler
npx wrangler login
Then create the project once — either in the dashboard or from the CLI:
npx wrangler pages project create chotigold-site
Attach your custom domain to the project in the dashboard (Pages → project → Custom domains). Cloudflare handles DNS and the certificate since the zone is already on Cloudflare.
The deploy
From then on, every deploy is a single command pointed at the output folder:
npx wrangler pages deploy dist --project-name chotigold-site
Wrangler hashes every file, uploads only the ones that changed, and flips the production deployment over. A typical run for this site:
✨ Success! Uploaded 1 files (6 already uploaded) (1.08 sec)
🌎 Deploying...
✨ Deployment complete!
Each deployment also gets its own preview URL (<hash>.chotigold-site.pages.dev), which is handy for checking a change before you trust it on the real domain — though with direct upload, production is updated immediately.
Wiring it into the build
I wrap the build and deploy together in package.json so there's no chance of shipping a stale dist/:
{
"scripts": {
"build": "node build.js",
"deploy": "node build.js && wrangler pages deploy dist --project-name chotigold-site"
}
}
npm run deploy, wait a few seconds, done.
Things worth knowing
- Clean URLs are automatic.
dist/blog/index.htmlis served at/blog/and/blogalike, so a generator that writesfolder/index.htmlneeds no extra routing config. - Rollbacks are one click. Every deployment is kept; the dashboard lets you promote any previous one back to production.
- Headers and redirects can be added with plain
_headersand_redirectsfiles in the output folder, if you ever need them.
For a site with no server, no build farm and no database, this is about as little infrastructure as it's possible to have while still owning the domain.