Last updated: 2026-07-12

🚀
Deployment — Castle Checkers Environment

Run all commands from Windows terminal in the project root. The sandbox environment (Claude) gets 403 on git push — always provide push commands for the user to run.

Deployment Commands

cd "E:\Claude_Projects\sonan-trackers\caretaker-portal-Claude\caretaker-portal"

# 1. Apply D1 migrations on remote database
npx wrangler d1 migrations apply caretaker_db --remote --env castlecheckers

# 2. Set JWT_SECRET Worker secret
npx wrangler secret put JWT_SECRET --env castlecheckers

# 3. Deploy the Worker
npx wrangler deploy --env castlecheckers

# 4. Push to GitHub (triggers Pages auto-deploy)
git push origin main

Cloudflare Pages Setup

One-time setup in the Cloudflare dashboard:

SettingValue
GitHub reposonantechai/caretaker-portal → main branch
Build commandnpm run build
Output directorydist
Environment variableVITE_API_URL = https://castlecheckers-api.sonandigital.com

Custom Domain

Pages project → Custom Domains → Add castlecheckers.sonandigital.com. Cloudflare handles the DNS record automatically since the domain is on the same Cloudflare account.

Post-Deploy First Login

Default admin password from migration 0002: Admin@2026. Log in immediately and change via Settings → Change Password. Then update business name, phone, email, address, and service types to match the client's actual info.

Adding a Second Caretaker Client

# 1. Add new env block to wrangler.toml (copy [env.castlecheckers], change name + D1 ID)
# 2. Create new D1: npx wrangler d1 create <new-client>_db
# 3. Write new migration 0002 seed for the new client
# 4. Deploy: npx wrangler deploy --env <new-client-env>
# 5. Create new Pages project → connect repo → set VITE_API_URL for new client
# 6. Add custom domain