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
InfrastructureTerraformHyperdrive configurations, optional R2 storage

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

EnvironmentIntended triggerURL patternPurpose
Developmentbun devlocalhost:5173Local development
StagingPush to mainstaging.example.comPre-production validation
ProductionManual dispatchexample.comLive environment

Staging and production each have their own Wrangler configuration, Hyperdrive bindings, and Terraform workspace. Development is local and provisions no cloud resources. See CI/CD for deployment triggers. The checked-in deployment step is disabled until Cloudflare credentials are configured.

Deployment Checklist

  1. Provision infrastructure – run Terraform to create the Hyperdrive configurations. Workers, routes and the custom domain's DNS come from Wrangler at deploy time (ADR-002)
  2. Set secrets – configure BETTER_AUTH_SECRET and RESEND_API_KEY, plus secrets for any optional integrations you enable, 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 run build        # Build all deployable workspaces
bun api:deploy --env="" # Deploy production API worker
bun app:deploy --env="" # Deploy production App worker
bun web:deploy --env="" # Deploy production Web worker

Section Pages