Geo Tracking - Specs

Cloudflare deployment

How to deploy the Specs site, maintain the lab Worker, and distribute Android artifacts.

The documentation and the lab are independent applications. Each has its own wrangler.jsonc, artifacts, and deployment command.

Deployment targets

ApplicationWorkerArtifact
Geo Tracking - Specsgeo-tracking-specsHTML, CSS, JavaScript, and search from specs/dist/client.
Lab and APIgeo-tracking-labtracking-server/src/index.ts, static dashboard, and data bindings.
Android APKDistributed by the labFile and checksum stored in the configured R2 bucket.

The deployment account is selected through Wrangler's account_id. Before a new deployment, confirm the session and account with npx wrangler whoami. Do not copy credential files into MDX content or the public directory.

Deploy this site

Use Node 24.21.0 or a later version compatible with the dependencies; .nvmrc and .node-version record the version used when preparing the app.

cd specs
npm ci
npm run typecheck
npm run lint
npm test
npm run build
npm run check:static
npm run deploy:check
npx wrangler whoami
npx wrangler deploy

npm run deploy combines the build, static-artifact verification, and deployment. Type, lint, and content checks remain available as separate commands.

The target uses Workers Static Assets. The configuration has no main: only dist/client is uploaded. The TanStack build also produces server files needed for prerendering, but they are not part of the published site.

vite.config.ts enumerates the MDX files to produce each page and fails if a route cannot be generated. The build also writes the home page, search index, and 404.html. not_found_handling: "404-page" returns an error page with a 404 status for nonexistent paths.

Verify the result

Run npm run preview and open http://localhost:4324. Check the home page, menu, links between guides, a page opened directly by URL, and a search for “geolocation” or “queue”. After deployment, repeat these checks at the URL returned by Wrangler and check a nonexistent path.

The index is public, as is the HTML. The documentation should contain anonymized examples and variable names, without tokens or location histories from real devices. The site does not need ADMIN_TOKEN, R2, or Durable Objects.

Deploy the lab

The existing lab uses the configuration in tracking-server/wrangler.jsonc. Its bindings are DEVICES, REGISTRY, and DOWNLOADS. The registered migrations create the SQLite classes TrackingDevice and DeviceRegistry.

cd tracking-server
npm ci
npm run check
npm test
npm run deploy:check
npm run deploy

When initially configuring an account or environment, the secrets ADMIN_TOKEN and DEVICE_TOKEN_SECRET must be provisioned through Wrangler, with values unique to that environment. The .dev.vars file serves the local environment and is not deployed automatically.

npx wrangler secret put ADMIN_TOKEN
npx wrangler secret put DEVICE_TOKEN_SECRET

Changing DEVICE_TOKEN_SECRET affects the derivation of existing credentials. It is not a transparent per-device rotation procedure. See authentication before changing this secret.

Deploying the documentation does not require redeploying the backend or changing its secrets.

Distribute the APK

The publishing script accepts an APK that has already been built and validated, calculates SHA-256, and uses part of the hash in the remote filename. It writes the APK and .sha256 file to R2 and returns the download URLs and metadata.

cd tracking-server
APK_PATH=/path/to/application.apk npm run publish:android

The dashboard's download link should then point to the validated artifact. The script does not automatically modify the dashboard HTML. The download route allows public reads of valid APK filenames; it does not list the bucket. See field testing for build, signing, and update details.

Update the documentation

  1. Check the implementation and contract of the changed feature.
  2. Update the MDX in src/content/docs/ and its entry in meta.json when needed.
  3. Review links between pages, examples, and the distinction between current and proposed capabilities.
  4. Run the checks and generate a new build before deployment.
  5. Verify the published site. Record test results with their date and environment.

Do not reuse historical conclusions as if they were new test runs. Changes to native collection require tests on the corresponding platforms in addition to site checks.

Repository sources

  • specs/package.json, specs/vite.config.ts, specs/wrangler.jsonc, and specs/test/.
  • tracking-server/package.json, tracking-server/wrangler.jsonc, and tracking-server/.dev.vars.example.
  • tracking-server/scripts/publish-android.mjs and tracking-server/src/downloads.ts.
  • tracking-server/public/index.html and scripts/build-android-fieldtest.py.

On this page