Every Cloudflare step is a command in this repository. No dashboard, and no command leaves a secret in a file.
| Command | What it does |
|---|---|
pnpm cf:setup |
Names the Worker, binds your domain, creates the D1 database and R2 bucket, migrates, builds, deploys, sets TOKEN_SECRET |
pnpm cf:media |
Makes the R2 bucket web-readable and writes media.baseUrl |
pnpm cf:secrets |
Sends every runtime secret in .env.prod to the Worker in one request; --dry-run shows the plan, --list the names and what is set |
pnpm cf:ci |
Pushes the build-time half of .env.prod to GitHub Actions and updates the workflow |
pnpm cf:doctor |
Reads it all back and says what is missing. Changes nothing |
Before you start
Section titled “Before you start”| You need | Command | You should see |
|---|---|---|
| A Cloudflare login | pnpm exec wrangler whoami |
your account name and id |
| Your domain on that account | pnpm exec wrangler zones list |
the domain in the list. Without one, pnpm cf:setup --workers-dev deploys to *.workers.dev; move later |
site.url set to that domain |
pnpm check:config |
site.config.ts OK — Your Directory (https://your-domain.com) |
-
See the plan.
Terminal pnpm cf:setup --dry-runIt prints the Worker name, route, database and bucket it would create, then
Nothing changed. -
Run it.
Terminal pnpm cf:setupEvery step prints a
✔, and steps already done say so; a rerun after a failure is safe. It ends with your/admin/password, shown once — store it now. -
Make uploaded images public.
Terminal pnpm cf:mediaWith the zone id it points
media.<your domain>at the bucket, otherwise at the rate-limitedr2.devURL. Either result goes intomedia.baseUrlinsite.config.ts. -
Put your secrets on the Worker.
Terminal cp .env .env.prod # then edit .env.prod: live Stripe keys, the real sender, and so onpnpm cf:secrets --dry-runpnpm cf:secretsThe dry run lists what would go up, each value’s length, and why anything is left out: empty, a placeholder, or the wrong field. Nothing uploads until you drop
--dry-run. -
Check the lot.
Terminal pnpm cf:doctorEvery line is either
✔or a problem with the command that fixes it.
Deploy on every push
Section titled “Deploy on every push”pnpm cf:ci --enablegit pushpnpm cf:cisends the build-time variables to GitHub Actions, as variables or secrets per the# ci:line above each key in.env.example.- It rewrites
env:in.github/workflows/deploy.yml, so a variable you add cannot go missing in CI. --enableturns the workflow on.- Deploy on git push has the alternative, Workers Builds.
Dashboard-only steps
Section titled “Dashboard-only steps”Verify
Section titled “Verify”| Check | Command | You should see |
|---|---|---|
| Everything at once | pnpm cf:doctor |
cf:doctor — … ok, 0 problems |
| The site | curl -s -o /dev/null -w '%{http_code}' https://your-domain.com/ |
200 |
| The admin area | open /admin/, signed in as an address in admin.emails |
the review queue |
| Secrets on the Worker | pnpm cf:secrets --list |
every key your configuration needs |