Local development
Prerequisites
Section titled “Prerequisites”- Bun 1.4 or newer.
- No Cloudflare account is needed for local work. Everything runs in
wrangler dev --localwith local D1, R2, KV and Queues.
First run
Section titled “First run”bun installbun run setup # creates workers/*/.dev.vars, migrates both local D1s, loads the seed and sample PDFsbun run dev # builds the sites, then starts the five Workers| URL | What |
|---|---|
| http://localhost:8787 | The app (staff and /portal), with /api, /auth and /agents proxied |
| http://www.localhost:8787 | The landing page |
| http://docs.localhost:8787 | These docs |
| http://localhost:8788 | cemco-api directly |
| http://localhost:8789 | cemco-auth directly |
| http://localhost:8790/mcp | cemco-mcp |
| http://localhost:8791 | cemco-agents |
*.localhost resolves to your machine in every current browser. For curl, send the host name:
curl -H "Host: docs.localhost:8787" http://127.0.0.1:8787/.
Links between the sites are written with their production URLs (https://app.cemco.app/...); outside production
cemco-web rewrites them to the local hosts, so clicking around works.
Sign in without Google
Section titled “Sign in without Google”With ENVIRONMENT=development in workers/auth/.dev.vars (set by bun run setup, and only there):
- Browser: open http://localhost:8787/auth/dev and pick a login.
- Scripts: send the header
x-cemco-dev-user: <email>.
curl -H "x-cemco-dev-user: cooper@cemcoinc.com" http://localhost:8787/api/v1/mecurl -X POST -H "x-cemco-dev-user: cooper@cemcoinc.com" -H "content-type: application/json" \ -d '{}' http://localhost:8787/api/v1/ops/reports.dashboard| Seed login | Who |
|---|---|
| cooper@cemcoinc.com | Staff, admin |
| maria@cemcoinc.com | Staff, editor |
| jake@cemcoinc.com | Staff, viewer |
| dana.whitfield@example.com | Customer, Red River Ready Mix |
| luis.ortega@example.com | Customer, Caprock Concrete Supply |
Any other cemcoinc.com address signs in as a new viewer. Outside development these routes return 404 and the header
is ignored.
Seed data
Section titled “Seed data”The seed is written relative to 2026-12-06: 10 accounts, 14 orders across all nine stages (SO-2026-0032 and SO-2026-0033 are not valid and sit at Received), 17 machines (M300-2419 is down with ticket T-00041), tickets in every status, 61 parts (about 20 with stale 2020 prices, several below their reorder point), 6 parts orders, overdue tasks and a pending portal invite.
Everyday commands
Section titled “Everyday commands”| Command | What it does |
|---|---|
bun run dev:workers |
Start the Workers without rebuilding the sites |
bun run dev:app |
Vite with hot reload on http://localhost:5173, proxying to 8787 |
bun run --filter @cemco/docs dev |
This site with hot reload on http://localhost:4322 |
bun run --filter @cemco/www dev |
The landing page on http://localhost:4321 |
bun run build |
Build views, app, www and docs into workers/web/public, then assemble |
bun run typecheck / lint / test |
Checks for every package |
bun run db:reset:local |
Wipe local state, migrate and seed again |
bun run db:seed:build |
Regenerate packages/db/seed/seed.sql from packages/db/scripts/seed-data.ts |
AI features locally
Section titled “AI features locally”Workers AI needs a Cloudflare login even in local mode. To use the assistant and nameplate reading locally, set
ANTHROPIC_API_KEY in workers/agents/.dev.vars and workers/api/.dev.vars. Without either, those features report
not connected and everything else works.
One process instead of five
Section titled “One process instead of five”bun run dev starts one wrangler dev --local per Worker; they find each other through wrangler’s dev registry.
bun run dev:multi runs all five in one process, but only after wrangler login: wrangler does not pass --local to
the second and later configs, so their AI binding asks for a Cloudflare session.