Skip to content

Local Development

  • Node.js >= 22
  • pnpm >= 10
  • Cloudflare account with Wrangler CLI logged in (wrangler login)
Terminal window
# Install dependencies (app + docs)
pnpm install
# Create local D1 database and apply schema + seed data
pnpm db:migrate
pnpm db:seed
# Start the app (Vite frontend + Wrangler Worker)
pnpm dev:all
# Or start docs site
pnpm dev:docs
ServiceURL
Frontend (Vite)http://localhost:5173
Worker APIhttp://localhost:8787
Docs (Starlight)http://localhost:4321

The Vite dev server proxies /api/* requests to the Worker at :8787.

Cloudflare Access is not present locally. The app provides a user picker on localhost:5173:

  1. Visit http://localhost:5173 — the dev user picker appears automatically
  2. Select an existing user from the list, or enter any @dotcollective.com.au email to create a new one
  3. The selected email is stored in localStorage and sent as a CF-Access-Mock-Email header on all API calls
  4. Use “Switch user” in the user dropdown menu to switch to a different user
  5. “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:

Terminal window
curl -H "CF-Access-Mock-Email: brendon@dotcollective.com.au" \
http://localhost:8787/api/users/me
Terminal window
pnpm dev # Frontend only
pnpm dev:worker # Worker only
pnpm dev:all # Both (recommended)
pnpm dev:docs # Docs site
pnpm build # Build frontend for production
pnpm build:docs # Build docs for production
pnpm db:migrate # Apply schema to local D1
pnpm db:seed # Apply seed data to local D1