Deployment
Prerequisites
Section titled “Prerequisites”- Cloudflare account with Workers plan
- D1 database created:
wrangler d1 create dotcollective-tools-db - Update
database_idinwrangler.tomlwith the ID from step 2
Deploy the App
Section titled “Deploy the App”# Build frontend + deploy Workerpnpm deployThis runs vite build then wrangler deploy, which:
- Builds the React SPA to
dist/ - Deploys the Worker with the built assets
- The
[assets]config serves the SPA and routes/api/*to the Worker
Deploy Docs
Section titled “Deploy Docs”The docs site deploys separately to Cloudflare Pages:
cd docspnpm build# Deploy via Cloudflare Pages dashboard or wrangler pagesPost-Deploy Setup
Section titled “Post-Deploy Setup”Apply Database Schema
Section titled “Apply Database Schema”wrangler d1 execute dotcollective-tools-db --remote --file=db/schema.sqlwrangler d1 execute dotcollective-tools-db --remote --file=db/seed.sqlConfigure Cloudflare Access
Section titled “Configure Cloudflare Access”- Go to Cloudflare Zero Trust dashboard
- Add Google Workspace as identity provider
- Create Access Application for
app.dotcollective.com.au - Set policy: Allow emails ending in
@dotcollective.com.au
Environment Variables
Section titled “Environment Variables”Set via wrangler.toml [vars] or Cloudflare dashboard:
| Variable | Purpose |
|---|---|
CF_ACCESS_TEAM_DOMAIN | Cloudflare Access team domain (e.g., dotcollective) |