Deployment
React Starter Kit deploys as three Cloudflare Workers backed by a Neon PostgreSQL database. Infrastructure is managed with Terraform.
What Gets Deployed
| Component | Target | Description |
|---|---|---|
| Web Worker | Cloudflare Workers | Edge router – receives all traffic, routes to app/api via service bindings |
| App Worker | Cloudflare Workers | Serves the React SPA and static assets |
| API Worker | Cloudflare Workers | Hono + tRPC server, authentication, database access |
| Database | Neon PostgreSQL | Managed Postgres with Hyperdrive connection pooling |
| Infrastructure | Terraform | Worker 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 terraformor download) - Domain added to Cloudflare DNS (optional for initial setup)
Environments
| Environment | Trigger | URL pattern | Purpose |
|---|---|---|---|
| Development | bun dev | localhost:5173 | Local development |
| Preview | Pull request | {codename}.example.com | Isolated PR testing (pr-codename) |
| Staging | Push to main | staging.example.com | Pre-production validation |
| Production | Manual dispatch | example.com | Live environment |
Each environment has its own Wrangler config, Hyperdrive bindings, and Terraform state. See CI/CD for how deployments are triggered.
Deployment Checklist
- Provision infrastructure – run Terraform to create workers, Hyperdrive, and DNS records
- Set secrets – configure
BETTER_AUTH_SECRET, Stripe keys, and other secrets via Wrangler. See Cloudflare Workers for the full list - Run migrations – apply schema to your production database. See Production Database
- 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 workerSection Pages
- Cloudflare Workers – Wrangler config, secrets, build and deploy
- Production Database – Neon setup, Hyperdrive, running migrations
- CI/CD – GitHub Actions pipelines, preview deployments
- Monitoring – Logs, analytics, rollbacks, troubleshooting