Deploy the Global Anti-CCP Resistance Hub to Cloudflare Pages for free (unlimited bandwidth, global CDN, automatic HTTPS).
Prerequisite: Complete SUPABASE_SETUP.md first. You need your Supabase URL and anon key before setting up Cloudflare.
- Go to Cloudflare Dashboard → Workers & Pages (left sidebar)
- Click Create → Pages tab → Connect to Git
- Sign in to GitHub when prompted
- Select the repository:
Stan2032/global-anti-ccp-resistance-hub - Click Begin setup
On the configuration page, set:
| Setting | Value |
|---|---|
| Project name | global-anti-ccp-resistance-hub (or any name you want) |
| Production branch | master (or whichever branch you want to deploy) |
| Framework preset | Select Vite (Cloudflare may auto-detect this) |
| Build command | npm run build |
| Deploy command | npx wrangler deploy |
| Root directory | / |
How it works:
npm run buildcreates thedist/folder, thennpx wrangler deploydeploys it using thewrangler.jsoncconfig in the repo root. SPA routing is handled bynot_found_handlingin that file.
On the same page (or go to Settings → Environment variables after creation), add:
| Variable name | Value |
|---|---|
VITE_SUPABASE_URL |
https://YOUR_PROJECT_ID.supabase.co |
VITE_SUPABASE_ANON_KEY |
Your Supabase anon key |
Note:
VITE_BASE_PATHis not required — the build defaults to/. The GitHub Pages workflow sets its own base path automatically. You can still override it if needed.Supabase variables are optional. Without them the site runs in static-only mode (forms show "Coming Soon" with links to real organizations).
Cloudflare will:
- Clone your repo
- Run
npm install - Run
npm run build(producesdist/) - Run
npx wrangler deploy(deploys usingwrangler.jsoncconfig)
Your site will be live at your Cloudflare Workers URL (e.g., https://global-anti-ccp-resistance-hub.stane203.workers.dev/)
- Go to your Pages project → Custom domains
- Click Set up a custom domain
- Enter your domain (e.g.,
resistancehub.org) - Follow the DNS instructions (either add a CNAME or transfer DNS to Cloudflare)
Enable Tor access so activists in censored regions can access the site anonymously:
- In your Cloudflare Dashboard → Network → Onion Routing → toggle ON
- Cloudflare automatically generates a
.onionaddress and injects theOnion-Locationheader - Tor Browser users will be automatically offered the
.onionversion
Full guide: See ONION_ROUTING_SETUP.md for detailed setup, testing, and troubleshooting steps.
┌─────────────────┐ git push ┌──────────────────────┐
│ GitHub Repo │ ────────────── │ Cloudflare │
│ (source code) │ auto-deploy │ (builds & deploys) │
└─────────────────┘ └──────────────────────┘
│
npm run build → dist/
│
npx wrangler deploy
(reads wrangler.jsonc)
│
┌────────┴────────┐
│ Global CDN │
│ (200+ cities) │
│ HTTPS + HTTP/3 │
└─────────────────┘
│
Browser fetches site
(SPA routing via
not_found_handling)
│
┌────────┴────────┐
│ Supabase │
│ (database) │
│ (form writes) │
└─────────────────┘
Every push to your production branch triggers an automatic redeploy.
| File | Purpose |
|---|---|
wrangler.jsonc |
Wrangler config — SPA routing via not_found_handling |
public/_headers |
Security headers (CSP, X-Frame-Options, etc.) |
public/robots.txt |
Search engine directives |
public/sitemap.xml |
SEO sitemap |
public/manifest.json |
PWA manifest |
ONION_ROUTING_SETUP.md |
Tor/onion routing setup guide |
- The
wrangler.jsoncfile configuresnot_found_handling: "single-page-application"which servesindex.htmlfor all unknown routes - If overriding
VITE_BASE_PATH, make sure it is set to/
- This was fixed — the
_redirectsfile was removed because it conflicts withnpx wrangler deploy. SPA routing is now handled bywrangler.jsonc. - If you see this error, make sure
public/_redirectsdoes not exist in your repo
- Make sure
VITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEYare set - Make sure you've run the SQL from
SUPABASE_SETUP.mdin the Supabase SQL Editor - Check browser console for connection errors
- Make sure
NODE_VERSION=20is set in environment variables (optional — Node 22 also works) - The build command should be
npm run build(notpnpm build) - The deploy command should be
npx wrangler deploy - Check the Cloudflare build logs for specific errors
- Clear Cloudflare cache: Pages project → Deployments → Manage → Purge cache
| Feature | GitHub Pages | Cloudflare |
|---|---|---|
| Base path | /global-anti-ccp-resistance-hub/ (via VITE_BASE_PATH in deploy.yml) |
/ (default) |
| Custom domain | Yes | Yes |
| HTTPS | Yes | Yes |
| Headers control | No | Yes (_headers) |
| SPA routing | 404.html fallback | wrangler.jsonc not_found_handling |
| Build | GitHub Actions | Built-in |
| CDN | GitHub's CDN | Cloudflare (200+ cities) |
| Cost | Free | Free |
You can run both simultaneously. The GitHub Pages workflow sets VITE_BASE_PATH
to its subdirectory path; Cloudflare uses the default /.