Skip to main content
This is the operator runbook for the migration stack:
  • apps/backend: Rust API runtime, native on port 7820, Docker sidecar, and Cloudflare Worker tuturuuu-backend.
  • apps/tanstack-web: TanStack Start frontend, local dev on port 7824, Docker sidecar, Cloudflare Worker tuturuuu-tanstack-web, and opt-in Vercel build validation.
This runbook describes future deployment capability. apps/backend is not currently deployed or used by production, and apps/web remains the live API runtime. Do not run the deployment sections or infer a cutover without explicit migration approval.
Keep the legacy apps/web runtime available until the cutover gates pass. This page explains how to start, validate, and deploy the new stack; route ownership and cutover evidence stay in the TanStack/Rust migration contract and cutover runbook.

Required Environment

Use real values only in ignored env files, shell variables, GitHub Environment secrets, Cloudflare Worker secrets, Vercel Project Environment Variables, or VPS secret stores. Do not commit values.

Local Native Run

Native local development is two processes: Rust backend first, then TanStack Start. apps/backend/.env.example is a template; the native Rust binary reads environment variables from the process environment.
  1. From the repo root, export local-only backend values:
  2. Start the Rust backend:
  3. In another shell, point TanStack Start at the backend and start the frontend:
  4. Verify the backend:
  5. Open the frontend on port 7824. The root migration shell should report the backend as reachable when the URL and token match.
Common local failures:
  • readyz is not ready: BACKEND_INTERNAL_TOKEN is missing from the backend process.
  • TanStack shows backend unreachable: the frontend shell does not have BACKEND_INTERNAL_URL or BACKEND_INTERNAL_TOKEN, or the backend is running on a different port.
  • Rust starts but route calls fail: the route may require additional Supabase, Aurora, Discord, cron, or app coordination env values.

Docker Dual-Stack Rehearsal

Use the minimal dual-stack compose file when you want production artifacts for only the migration stack:
The default loopback ports are: Run the minimal Playwright E2E rehearsal:
Keep the stack up for manual debugging:
Shut it down when finished:
Use the broader production web Docker path when the migration stack needs to run behind web-proxy, blue/green cutover, watcher recovery, Redis, cron, or Cloudflare Tunnel. That path is covered in Web Docker Deployment.

Cloudflare Workers Deployment

Cloudflare Workers is the edge preview path for both runtimes. The frontend Worker uses the BACKEND service binding to call the backend Worker first, with HTTP env fallback only for local and emergency non-binding runs. This follows the current TanStack Start Cloudflare guidance for @cloudflare/vite-plugin plus wrangler.
  1. Authenticate and validate config:
  2. Install Rust Worker prerequisites if the machine has not built Workers before:
  3. Bootstrap backend Worker secrets in Cloudflare:
  4. Deploy the backend Worker first:
  5. Bootstrap TanStack Worker secrets:
  6. Generate Worker types and deploy the TanStack Worker:
  7. Smoke both Worker origins:
For secret rotation on an already serving Worker, prefer the versions flow:
Rollback is Worker-version or route/DNS based:
External references: TanStack Start hosting, Cloudflare TanStack Start, Wrangler configuration, and Cloudflare Worker secrets.

Vercel Frontend Build Validation

Vercel is used to validate that apps/tanstack-web can produce Vercel-compatible TanStack Start output. This repository does not deploy or publish the TanStack frontend to Vercel. The Rust backend must still be reachable over HTTPS during the build, usually through the Cloudflare backend Worker or a self-hosted backend origin. Vercel mode uses the app-local TANSTACK_WEB_RUNTIME=vercel branch and Nitro, matching the current Vercel TanStack Start guidance. Configure the Vercel project: Required Vercel Project Environment Variables: Manual CLI sequence from the repo root:
Production uses the same sequence with vercel pull --environment=production and vercel build --prod. It intentionally does not run vercel deploy. GitHub Actions owns the normal path:
  • .github/workflows/vercel-preview-tanstack-web.yaml
  • .github/workflows/vercel-production-tanstack-web.yaml
The workflows use VERCEL_TANSTACK_WEB_PROJECT_ID, VERCEL_ORG_ID, and VERCEL_TOKEN inside the build jobs only. Preview builds require workflow_dispatch from protected main plus a trusted actor. Production builds run from the production branch. They record build markers after vercel build passes and do not create Vercel deployments. External references: Vercel TanStack Start, vercel pull, vercel build.

VPS Or Self-Hosting With Cloudflare Tunnel

Self-hosting uses the existing production Docker stack. Use this when the full platform proxy, blue/green deployment history, watcher recovery, and Cloudflare Tunnel container should own traffic.
  1. Prepare the server:
  2. Put production env values in root .env.local or an explicit deployment env file. Set the frontend selector and backend token:
  3. If using Cloudflare Tunnel, create a remotely managed tunnel in Cloudflare Zero Trust, add a public hostname for the desired domain, and route it to:
    Store the tunnel token as CF_TUNNEL_TOKEN, CLOUDFLARED_TOKEN, or DOCKER_CLOUDFLARED_TOKEN in the server env file. The Docker helper maps CF_TUNNEL_TOKEN to the Compose CLOUDFLARED_TOKEN.
  4. Start the TanStack production stack without a tunnel:
    Start it with the bundled Cloudflare Tunnel sidecar:
    A non-empty CF_TUNNEL_TOKEN in root .env.local also auto-enables the tunnel sidecar unless the Docker helper is explicitly opted out.
  5. Verify through the local proxy:
  6. Verify through the public hostname after Tunnel reports healthy:
  7. Stop the stack:
Rollback options:
  • Blue/green: use the existing cached rollback path documented in Web Docker Deployment.
  • Git: check out the previous known-good commit and rerun DOCKER_WEB_FRONTEND=tanstack bun serve:web:docker:bg.
  • Tunnel: remove or change the Cloudflare public hostname route while the local stack is repaired.
External references: Cloudflare Tunnel setup and Cloudflare remote tunnel creation.

Verification Checklist

Run these before handing off a local or deployment-config change:
Do not run deploy commands, production Supabase pushes, or long build commands from an implementation session unless the user explicitly requested live deployment or build execution.