---
description: Cloudflare Pages deploy procedure for gazperi.com — Wrangler from local repo, custom domain, rollback.
load-when: Deploying the site, debugging a deploy failure, or rotating Cloudflare access.
---
# Cloudflare deploy
Hosting: Cloudflare Pages, project name `gazperi-com`. Domain `gazperi.com` is on Cloudflare nameservers (registrar: Hostinger). Deploys are triggered manually from the local repo via Wrangler — no CI, no GitHub remote.
## One-time setup
| Item | Where |
| --------------------------------- | ------------------------------------------------------------ |
| Cloudflare account | https://dash.cloudflare.com |
| Pages project | `gazperi-com` (created via dashboard or `wrangler pages project create gazperi-com`). |
| Wrangler login | `npx wrangler login` once per machine. |
| Custom domain | Bound via Pages → Custom Domains → `gazperi.com` and `www.gazperi.com`. |
| DNS | `gazperi.com` zone managed in Cloudflare; nameservers set at Hostinger. |
| Environment variables | Pages → Settings → Environment Variables: `POSTHOG_KEY`, `POSTHOG_HOST` (production + preview). |
**Build locally.** `cd /Users/gazperi/Developer/SITE/site-com && npm run build`. Confirm `build/` is fresh and `npm run serve` smoke-passes.
**Deploy.** `npx wrangler pages deploy build --project-name=gazperi-com`. Wrangler prints a `*.pages.dev` preview URL (current deploy) and the production URL. Visit the preview URL first to verify the build before traffic flips.
**Promote to production.** Cloudflare Pages auto-promotes the latest deploy to production. To deploy to a named branch instead: `--branch=preview` (or other). Production lives on `main`-equivalent default branch alias.
**Verify live.** `curl -I https://gazperi.com` returns 200 and the right headers. Open the site, click Educação, confirm the docs route works, confirm PostHog events fire.
**Rollback.** Cloudflare Pages → project → Deployments → choose a previous successful deploy → "Rollback to this deployment". Or redeploy a previous local build state.
## DNS cutover (one-time, when migrating from another host)
1. In Cloudflare, add the `gazperi.com` zone. Cloudflare scans existing DNS records; review and accept.
2. In Hostinger console, change the domain's nameservers to the two Cloudflare values shown.
3. Wait for propagation (`dig NS gazperi.com` — should return `ns1.cloudflare.com` / similar). Typically minutes; can be hours.
4. Bind `gazperi.com` and `www.gazperi.com` (CNAME redirect to apex) to the Pages project under Custom Domains.
5. Cloudflare provisions SSL automatically. Verify HTTPS works.
6. The previous host (Netlify) remains live until propagation completes — no downtime if records are correct.
**Rollback the cutover:** revert nameservers at Hostinger to the previous values. Domain returns to the old host within propagation window.
- `wrangler pages deploy` without `--project-name` — picks an interactive prompt, fragile in scripts.
- Editing DNS records directly in Cloudflare while nameservers still point at Hostinger — changes have no effect.
- Skipping the preview-URL check before promoting to production.