Local Development
Prerequisites
Section titled “Prerequisites”- Node.js >= 22
- pnpm >= 10
- Cloudflare account with Wrangler CLI logged in (
wrangler login)
# Install dependencies (app + docs)pnpm install
# Create local D1 database and apply schema + seed datapnpm db:migratepnpm db:seed
# Start the app (Vite frontend + Wrangler Worker)pnpm dev:all
# Or start docs sitepnpm dev:docs| Service | URL |
|---|---|
| Frontend (Vite) | http://localhost:5173 |
| Worker API | http://localhost:8787 |
| Docs (Starlight) | http://localhost:4321 |
The Vite dev server proxies /api/* requests to the Worker at :8787.
Dev Mode Authentication
Section titled “Dev Mode Authentication”Cloudflare Access is not present locally. The app provides a user picker on localhost:5173:
- Visit
http://localhost:5173— the dev user picker appears automatically - Select an existing user from the list, or enter any
@dotcollective.com.auemail to create a new one - The selected email is stored in
localStorageand sent as aCF-Access-Mock-Emailheader on all API calls - Use “Switch user” in the user dropdown menu to switch to a different user
- “Log out” clears the selection and returns to the picker
New users created via the picker default to employee access level and DL job role. Use the Admin panel (as an executive) to change access levels.
For direct API calls without the browser:
curl -H "CF-Access-Mock-Email: brendon@dotcollective.com.au" \ http://localhost:8787/api/users/meUseful Commands
Section titled “Useful Commands”pnpm dev # Frontend onlypnpm dev:worker # Worker onlypnpm dev:all # Both (recommended)pnpm dev:docs # Docs sitepnpm build # Build frontend for productionpnpm build:docs # Build docs for productionpnpm db:migrate # Apply schema to local D1pnpm db:seed # Apply seed data to local D1