A ZeroDirs site is static files plus a small Worker. pnpm cf:setup builds the Cloudflare side of
it from site.url in site.config.ts.
-
Check the account and the domain.
Terminal pnpm exec wrangler whoami # not signed in? pnpm exec wrangler loginpnpm check:config # site.config.ts OK — <your site> (https://your-domain.com)site.urlmust be your own domain:https://, no trailing slash, zone on this account. -
See the plan. Nothing changes yet.
Terminal pnpm cf:setup --dry-runPlan:Worker name acme-directory (renamed from the template)Route acme.com (custom domain) (changes wrangler.jsonc)D1 database acme-directory (create)R2 bucket acme-directory-media (create if missing)Then migrations → build → deploy → TOKEN_SECRETNothing changed. -
Run it. It asks once and skips what is already done.
Terminal pnpm cf:setup -
Nothing to store. If
.envstill held the placeholderTOKEN_SECRET,cf:setupgenerates one, saves it to.envand sets it on the Worker; the admins are the addresses inadmin.emails, and they sign in like anybody else. -
Read “What is left”.
Done. The site is at https://acme.comWhat is left:• Paid plans are on: pnpm cf:secrets STRIPE_SECRET_KEY STRIPE_WEBHOOK_SECRET, …• Sign in at /login/ as you@acme.com — with Google, or with a password set through "Forgot password?" so the address is proven — and /admin/ will list anything this configuration still needs.
If it stops
Section titled “If it stops”| Message | Fix |
|---|---|
site.url is still … |
Point site.url at your domain, re-run |
| R2 could not create the bucket | One-time R2 sign-up: dashboard → R2 → Get started |
| the domain does not answer after a few minutes | Add the zone to this Cloudflare account, re-run |
By hand
Section titled “By hand”pnpm exec wrangler loginpnpm exec wrangler d1 create acme-directory # paste the id into wrangler.jsonc → d1_databases[0].database_idpnpm exec wrangler r2 bucket create acme-directory-mediapnpm cf:typegen # worker-configuration.d.ts follows the bindingspnpm db:migrate:remotepnpm check:configpnpm deploy # = astro build && wrangler deploypnpm cf:secrets TOKEN_SECRETSet name and routes in wrangler.jsonc first.
pnpm check:configpnpm deploy/submit/, /admin/ and the checkout routes answer 404 until a database exists.
Verify
Section titled “Verify”| Command or URL | You should see | |
|---|---|---|
| Everything at once | pnpm cf:doctor |
cf:doctor — N ok, 0 warnings, 0 problems; anything else names the fix |
| The site | https://<your domain>/ |
your home page, your name in the footer |
| The admin | https://<your domain>/admin/, signed in as an address in admin.emails |
the review queue; it reports what is still missing |
| The Worker’s secrets | pnpm cf:secrets --list |
what is set, and what site.config.ts still needs |
Worth knowing
Section titled “Worth knowing”site.urlbakes into canonicals, the sitemap, the feeds and the OG images at build time — change it and deploy again.- Without a domain on Cloudflare,
pnpm cf:setup --workers-devdeploys to<worker-name>.<your-subdomain>.workers.devwith no route; re-run without the flag oncesite.urlis your domain. cf:setupleaves thesend_emailbinding out when your account cannot send mail yet.pnpm cf:secretssends every runtime secret in.env.prodin one request and never prints a value;--dry-runshows the plan first, and a name (pnpm cf:secrets STRIPE_SECRET_KEY) sends only that one.
What is left
Section titled “What is left”| Step | Why | Page |
|---|---|---|
| Make uploaded images public | pnpm cf:media: private bucket, media.baseUrl still on the demo |
Logos and media |
| Give the builder the real database | Workers Builds / Actions need the three D1 credentials; the site you just deployed was built from your local database | The build’s database |
| Deploy on every push, and after every approval | pnpm cf:ci --enable turns the GitHub Actions workflow on |
Deploy on git push, then Publishing on approval |
| Send mail | Receipts and approvals wait in the outbox | |
| Take money | Paid plans need two Stripe secrets and a webhook | Plans and payments |
| Let submitters sign in with Google | Email and password already work; Google is optional | Submitter accounts |
Directory
scripts/cloudflare-setup.ts— the command itself, step by step, with--dry-run,--workers-devand--yescf-media.ts—pnpm cf:media: the bucket’s public URL, written intosite.config.tscf-doctor.ts—pnpm cf:doctor: the read-only check, and--manualfor the dashboard-only stepsdev-setup.ts— whatpnpm devruns first:.envfrom the example, local migrations, the demo seed while the database is empty
wrangler.jsonc—name,routes, the D1 id and the R2 bucket are written hereworker-configuration.d.ts— regenerated from the bindings;pnpm checktype-errors without it.env— gitignored;TOKEN_SECRETends up here as well as on the Worker
Related
Section titled “Related”Environment and secretsEvery variable and secret, where it lives, and what breaks without it.
Deploy on git pushGitHub Actions in two commands, or Workers Builds in the dashboard — pick one.
Publishing on approvalThe Deploy Hook that turns an approval into a live page.
TroubleshootingThe build stopped, the deploy looks wrong, the canonicals point elsewhere.