Cloudflare Pages
Pages Projects
Section titled “Pages Projects”Two Cloudflare Pages projects serve the platform:
| Project | Purpose | Default branch |
|---|---|---|
convertella-admin | CRM + Operator panel | spike/cf-runtime |
convertella-buyer-platform-testing / convertella-buyer-platform-production | Buyer portal (tenant-facing) | preview / production |
convertella-platform | Worker name for local wrangler / shared build | — |
Branch Previews (Testing/Staging)
Section titled “Branch Previews (Testing/Staging)”Every push to any branch automatically triggers a Cloudflare Pages build and deploy as a preview deployment. This is the primary testing/staging mechanism — no separate staging server needed.
git push origin feature/add-csv-export → Pages builds the branch → https://convertella-admin-add-csv-export.pages.dev (2-3 min)Preview deployments:
- Inherit environment variables from the Pages project (
DATABASE_URL,CLOUDFLARE_API_TOKEN, etc.) - Connect to the testing Neon database (same as local dev)
- Are fully functional — OTP emails, R2 uploads, Cloudflare API calls all work
- Update automatically on each subsequent push to the same branch
- Deactivate automatically when the branch is deleted
- Are publicly accessible by default (anyone with the URL can browse)
Using Previews
Section titled “Using Previews”# Push a branch → get a preview URLgit checkout -b feature/add-csv-exportgit push origin feature/add-csv-export# → https://convertella-admin-feature-add-csv-export.pages.dev
# The URL follows the pattern:# https://{project-name}-{sanitized-branch-name}.pages.devDefault Branch
Section titled “Default Branch”The default branch (spike/cf-runtime for admin, production for buyer portal) deploys as the project’s main Pages deployment. It also has a .pages.dev URL and is the source for production promotion.
Production Deployment
Section titled “Production Deployment”Production uses wrangler.toml [env.production] to deploy to the production Cloudflare Pages project:
[env.production]name = "convertella-admin"routes = [ { pattern = "admin.convertella.app" },]Production differs from branch previews:
- Uses a separate Neon database (production branch, not testing)
- Has its own R2 buckets (production data isolated from testing)
- Uses separate Cloudflare API tokens with production-scoped permissions
- Serves on
admin.convertella.appvia custom domain - Buyer portals use Cloudflare for SaaS custom hostnames
Deploying to Production
Section titled “Deploying to Production”npm run deploy:pages:prodWrangler Configuration
Section titled “Wrangler Configuration”Base configuration in wrangler.toml:
name = "convertella-admin"pages_build_output_dir = "./dist"compatibility_date = "2026-05-01"routes = [ { pattern = "convertella.app" },]
[vars]PRIMARY_LOCALE = "de"R2_DOCUMENTS_BUCKET = "convertella-documents"
[env.staging]name = "convertella-admin-staging"
[env.production]name = "convertella-admin"routes = [ { pattern = "admin.convertella.app" },]Sensitive values are set via Cloudflare Pages dashboard (wrangler secret):
DATABASE_URL— Neon connection stringAUTH_SECRET— Lucia session signing keyCLOUDFLARE_API_TOKEN— Custom hostnames + API accessCLOUDFLARE_ZONE_ID— Cloudflare zone for for-SaaS operations
Non-sensitive defaults are in wrangler.toml [vars].
Buyer Portal Domains (Cloudflare for SaaS)
Section titled “Buyer Portal Domains (Cloudflare for SaaS)”See Cloudflare for SaaS for fallback origin, testing vs production routing, and reusing demo.convertella.app as a pilot hostname.
Deployment Commands
Section titled “Deployment Commands”| Command | Purpose |
|---|---|
npm run build | Production build via Astro |
npm run deploy:pages:prod | Deploy to production |
wrangler pages deploy dist/ --branch=<name> | Deploy specific branch as preview |