ADR 010 — TanStack as the Vox web spine
Status: Accepted
Date: 2026-03-21
Context
Vox compiles .vox UI to React + Vite (vox-codegen-ts), serves static assets via Axum + rust_embed (vox-codegen-rust), and optionally builds a second islands bundle. Prior routing used react-router-dom emitted from routes { declarations. The ecosystem direction is TanStack Router (typed, composable) and TanStack Start (Vite-native full-stack SSR, built on Router).
Non-goals: HTML-fragment UIs and classless CSS microframeworks as product paths; the supported graph is React + Tailwind/ShadCN + TanStack (see vox-web-stack SSOT).
Decision
- Routing spine: Adopt @tanstack/react-router for codegen from
routes {(replacingreact-router-dom). - Long-term framework: Plan TanStack Start for default SSR after Router is stable in our scaffold; Start includes Router—there is no separate “merge” of incompatible TanStack products, only composition (optional TanStack Query / Table later).
- SSR production topology (default recommendation): Option B — Axum reverse-proxies HTML/document requests to a Node-hosted TanStack Start / Vite SSR server, while Axum remains the API and static asset origin for
/apiand embeddedpublic/. Alternatives (A: API-only Axum + separate SSR host; C: hybrid static shells fromvox-ssg+ selective SSR) remain documented in the roadmap. - Examples policy: Maintain a small golden set (5–12) of
.voxexamples that CI/parser treat as canonical; move or archive the rest. - v0.dev: First-class for both the main generated app and islands; TSX must use named
export function Namealigned withroutes {/ Router (normalization invox-cli). vox-codegen-html: Retired as a workspace crate name—there is no in-tree implementation; static HTML needs are served byvox-ssgplus the React stack (see reconciliation in roadmap).
Consequences
- Dependencies: Generated app
package.jsoncarries@tanstack/react-routerinstead ofreact-router-dom. - Dev UX: Until Start is wired,
vox runremains SPA + Axum; SSR requires an additional process when enabled (documented in how-to). - Docs: Roadmap and backlog live under
docs/src/reference/tanstack-web-roadmap.mdandtanstack-web-backlog.md.
References
- TanStack Router — Vite
- TanStack Start — React
- vox-web-stack.md
- vox-fullstack-artifacts.md — canonical vs legacy artifacts (
server.ts,VOX_EMIT_EXPRESS_SERVER, containers)