Customer Solution
New Client Deployment Template
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-portalGitHub repo - Client's domain (or use
.pages.devfor 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
| File | What to Change |
|---|---|
index.html | <title> tag |
src/App.tsx | Business name constant, logo path |
src/index.css | --primary color (keep it dark and readable) |
public/logo.png | Replace with client logo |
Step 6 — Deploy Worker
npx wrangler deploy --env newclient
Step 7 — Deploy Frontend (Cloudflare Pages)
- Cloudflare Dashboard → Pages → Create project → connect GitHub repo
- Build command:
npm run build/ Output:dist - Env var:
VITE_API_URL=https://caretaker-api-newclient.<account>.workers.dev - Note the
.pages.devURL, updateCORS_ORIGINin 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
- Share portal URL and default credentials
- Walk through the First Login Checklist
- Confirm they change the default password
- Log the deployment in the Projects page