Back to docs

Documentation

Architecture

How TanStack Start, Cloudflare Workers, and ZShip services fit together.

Article
PreviousNext

The template is a browser-to-BFF-to-service architecture.

Browser UI
  -> local /api/** TanStack server route
  -> src/lib/server/zship-proxy.ts
  -> Cloudflare Service Binding when available
  -> HTTP fallback URL when running locally
  -> existing ZShip backend Worker

Routing

Routes are defined with createFileRoute and createRootRoute. TanStack generates routeTree.gen.ts, and src/router.tsx creates the app router.

Server routes

Every backend-facing operation lives under src/routes/api/**. Public machine-readable SEO surfaces live at:

  • /sitemap.xml
  • /robots.txt
  • /llms.txt
  • /llms-full.txt

Those handlers run server-side, so browser code does not need backend service secrets or direct app-key mutation authority.

Worker deployment

wrangler.jsonc points main to @tanstack/react-start/server-entry, enables nodejs_compat, and declares Service Bindings for auth, pay, support, blog, check-in, AI, CDN, site, prompt, provider1, and enterprise billing.

Shared client providers

src/lib/client/app-providers.tsx wraps the app with:

  • TanStack Query for request caching and mutations
  • the local i18n provider for language and API locale state
  • the theme provider for light, dark, and system modes