Skip to content

Environments

Convertella uses Cloudflare Pages branch previews as the staging mechanism. Every Git branch automatically gets a unique preview URL — there is no separate staging server or test environment to maintain.

LayerURLDatabaseWho
Local devhttp://localhost:4321Testing Neon DB (.env)Developer
Feature branchconvertella-admin-<branch>.pages.devTesting Neon DB (shared)Developer + reviewer
Default branchconvertella-admin-<slug>.pages.devTesting Neon DB (shared)Continuous deployment
Productionadmin.convertella.appProduction Neon DBEnd users

Cloudflare Pages automatically deploys every push to every branch as a preview deployment:

feature/add-csv-export → https://convertella-admin-add-csv-export.pages.dev
fix/login-otp-timing → https://convertella-admin-fix-login-otp-timing.pages.dev
spike/cf-runtime → https://convertella-admin-spike-cf-runtime.pages.dev

Preview deployments inherit the project’s environment variables (DATABASE_URL, CLOUDFLARE_API_TOKEN, etc.) so they are fully functional — they connect to the same testing database, send real OTP emails, and talk to Cloudflare APIs.

DatabaseUsed byPurpose
Testing Neon DBLocal dev + all branch previews + default branchFeature development, testing, staging verification
Production Neon DBProduction Pages deploymentLive tenant data

No third DB is needed because:

  • Branch previews already isolate code changes from production
  • Schema migrations run against the testing DB first and are verified in preview deployments
  • Cloudflare Pages automatically resets preview deployments on each push (no state to clean up)
Developer push → Pages builds → Preview URL ready (2-3 min)
↓
Test in preview → Fix → Push again → Updated preview
↓
Merge to default branch → Production build + deploy
↓
Delete feature branch → Preview URL deactivated automatically
  1. Any branch can be previewed — no special naming convention required
  2. All previews share the testing database — be mindful of test data collisions
  3. Production deploys only from the default branch (spike/cf-runtime / main)
  4. Database migrations run manually against testing first; production migrations run only when deploying production
  5. Destructive migrations (DROP, ALTER COLUMN) should avoid impacting other branch previews — prefer additive changes
  6. Preview URLs are public — anyone with the URL can access them (use Cloudflare Access for sensitive admin previews if needed)

Production has its own Pages project with:

  • A separate Neon database (production branch)
  • Separate R2 buckets
  • Separate Cloudflare API tokens (scoped to production resources)
  • Cloudflare for SaaS custom hostnames for buyer portals

The wrangler.toml [env.production] section configures the production project name and routes.

Comparison: This vs. Three-Environment Model

Section titled “Comparison: This vs. Three-Environment Model”
ConcernTraditional dev/staging/prodBranch-as-Environment (this project)
IsolationSeparate DBs per stageShared testing DB, separate prod DB
Cost~$50-100/mo extra$0 extra (branch previews included in Pages plan)
Setup complexityHigh (3x infra, 3x env vars, 3x pipelines)Low (one config, branches handle the rest)
Schema migration safetyTest migrations on staging firstTest migrations locally + in branch preview
Data privacyStaging can have anonymized prod cloneShared testing DB — careful with real data
Team collaborationDedicated staging URL for QAEach branch gets its own URL