Skip to content

Deployment

React Starter Kit deploys as three Cloudflare Workers backed by a Neon PostgreSQL database. Infrastructure is managed with Terraform.

What Gets Deployed

ComponentTargetDescription
Web WorkerCloudflare WorkersEdge router – receives all traffic, routes to app/api via service bindings
App WorkerCloudflare WorkersServes the React SPA and static assets
API WorkerCloudflare WorkersHono + tRPC server, authentication, database access
DatabaseNeon PostgreSQLManaged Postgres with Hyperdrive connection pooling
InfrastructureTerraformWorker metadata, Hyperdrive configs, DNS records

See Architecture Overview for how these components connect.

Prerequisites

  • Cloudflare account with Workers enabled
  • Neon account for PostgreSQL hosting (sign up)
  • Terraform installed (brew install terraform or download)
  • Domain added to Cloudflare DNS (optional for initial setup)

Environments

EnvironmentTriggerURL patternPurpose
Developmentbun devlocalhost:5173Local development
PreviewPull request{codename}.example.comIsolated PR testing (pr-codename)
StagingPush to mainstaging.example.comPre-production validation
ProductionManual dispatchexample.comLive environment

Each environment has its own Wrangler config, Hyperdrive bindings, and Terraform state. See CI/CD for how deployments are triggered.

Deployment Checklist

  1. Provision infrastructure – run Terraform to create workers, Hyperdrive, and DNS records
  2. Set secrets – configure BETTER_AUTH_SECRET, Stripe keys, and other secrets via Wrangler. See Cloudflare Workers for the full list
  3. Run migrations – apply schema to your production database. See Production Database
  4. Build and deploy – push code to workers. See CI/CD or deploy manually:
bash
bun build            # email → web → api → app
bun api:deploy       # Deploy API worker
bun app:deploy       # Deploy App worker
bun web:deploy       # Deploy Web worker

Section Pages