BCycle Map supports two local development modes. The lightweight mode starts only the Vite dev server and is enough for verifying tests pass and the basemap renders — no Cloudflare credentials required. The full-stack mode adds two Wrangler processes backed by Miniflare so you can develop and test Worker code without pushing anything to Cloudflare. Both modes are covered below.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/samgutentag/bcycle-map/llms.txt
Use this file to discover all available pages before exploring further.
Mode 1: Frontend only (no Workers)
Use this mode when you want to iterate on UI code, run the test suite, or verify the basemap renders on a fresh clone./api/... returns 404 because there is no Worker running. That’s expected.
Pointing at the deployed Worker for live data: If you want real station data without running Workers locally, copy .env.example to .env.local and set the read API URL:
VITE_API_BASE set, npm run dev:web fetches from the deployed Worker and every /api/... call succeeds, so you get live data in the local frontend without spinning up any local Workers.
Mode 2: Full-stack with local Workers
Use this mode when developing or debugging Worker code. Wrangler runs both the read API and the poller inside Miniflare, which simulates KV and R2 locally on disk.Terminal 1 — read API on port 8787
Start the read API Worker. Port 8787 matches the proxy target configured in
vite.config.ts, so the frontend’s /api/... requests are forwarded here automatically.Terminal 2 — poller on port 8788 with test-scheduled
Start the poller Worker on a different port. The
--test-scheduled flag exposes the /__scheduled HTTP endpoint so you can trigger the cron handler manually instead of waiting for the real timer.Terminal 3 — Vite dev server
Start the frontend. Because Open http://localhost:5173. The map will render but the station markers will be empty until data is seeded in the next step.
VITE_API_BASE is not set (or is empty), Vite’s proxy forwards every /api/... request to localhost:8787 where the read API is listening.Simulating the production cron
To keep local KV fresh during a longer dev session, run the poller on a loop at the same 5-minute cadence as production:When running local Workers, do not set
VITE_API_BASE in .env.local (or set it to an empty string). If VITE_API_BASE is set to a remote URL, Vite skips its proxy and the frontend talks to the deployed Worker instead of your local one.Available npm scripts
| Script | What it does |
|---|---|
npm test | Run Vitest once and exit |
npm run test:watch | Vitest in interactive watch mode |
npm run typecheck | tsc --noEmit — type-checks the entire project |
npm run dev:web | Vite dev server at http://localhost:5173 |
npm run dev:worker | wrangler dev (poller only, local Miniflare) |
npm run build:web | Production Vite build → dist/ |
npm run deploy:worker | wrangler deploy (deploys the poller to Cloudflare) |