Step-by-step template for deploying the Caretaker Portal to a new client. Based on the Castle Checkers build. Estimated time: 2–3 hours.

Prerequisites

  • Cloudflare account with Workers Paid plan (D1 requires it)
  • Wrangler CLI: npm install -g wrangler
  • Access to the caretaker-portal GitHub repo
  • Client's domain (or use .pages.dev for MVP)

Step 1 — Clone & Configure

git clone https://github.com/sonantechai/caretaker-portal
cd caretaker-portal
npm install
cd worker && npm install && cd ..

Add a new [env.<clientslug>] block in wrangler.toml:

[env.newclient]
name = "caretaker-api-newclient"
d1_databases = [
  { binding = "DB", database_name = "caretaker_db_newclient", database_id = "<see step 2>" }
]
[env.newclient.vars]
CORS_ORIGIN = "https://newclient.pages.dev"

Step 2 — Create D1 Database

npx wrangler d1 create caretaker_db_newclient
# Copy the database_id into wrangler.toml above

npx wrangler d1 migrations apply caretaker_db_newclient --remote --env newclient

Step 3 — Set Secrets

npx wrangler secret put JWT_SECRET --env newclient

Step 4 — Seed Admin Account

# Generate hash
import hashlib, binascii
dk = hashlib.pbkdf2_hmac('sha256', b'Admin@2026', b'SONAN_SP_2026', 100000)
print(binascii.hexlify(dk).decode())

# Insert admin
npx wrangler d1 execute caretaker_db_newclient --remote --env newclient --command   "INSERT INTO admins (id, email, password_hash, created_at)    VALUES ('admin-001', 'admin@newclient.com', '<hash>', datetime('now'))"

Step 5 — Customize Branding

FileWhat to Change
index.html<title> tag
src/App.tsxBusiness name constant, logo path
src/index.css--primary color (keep it dark and readable)
public/logo.pngReplace with client logo

Step 6 — Deploy Worker

npx wrangler deploy --env newclient

Step 7 — Deploy Frontend (Cloudflare Pages)

  1. Cloudflare Dashboard → Pages → Create project → connect GitHub repo
  2. Build command: npm run build / Output: dist
  3. Env var: VITE_API_URL=https://caretaker-api-newclient.<account>.workers.dev
  4. Note the .pages.dev URL, update CORS_ORIGIN in wrangler.toml, redeploy worker

Step 8 — Custom Domain (Optional)

Cloudflare Pages → Custom Domains → add the client domain. Update CORS_ORIGIN and redeploy.

Step 9 — Handoff to Client

  1. Share portal URL and default credentials
  2. Walk through the First Login Checklist
  3. Confirm they change the default password
  4. Log the deployment in the Projects page