0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/docs/start/framework/react/guide
Manuel Schiller 99df5ae424 feat: experimental route modules for file-based routing
Route modules are workspace packages that own a subtree of file-based routes and are mounted into applications or other modules. A package declares `tanstack.router.module` in its package.json. The generator gives it qualified route ids (`<pkg>:<path>`), a generated route scope (`routeScope.gen.ts` plus one namespace file per included or used module), a public contract (`routeContract.gen.ts`, exported as `./route-types` after the package's own declaration build), a runtime entry (`routeModule.gen.ts`, exported as `./route-module`) and a topology manifest (`.tanstack/route-module.json`). Includers mount modules with the `routeModules` option: `includes` chooses the host route and mount path, optionally under path params, `uses` references modules mounted elsewhere, and an application installs a module several times by including it once per installation named with `as`, each with its own namespace and route ids (`<pkg>#<as>:<path>`). Matches of module routes carry `localRouteId`, and the generated `isScopedMatch` guard narrows whole-router matches by module id prefix.

Runtime: the generated host tree mounts module roots with the internal `mountRouteModule`; module-local ids, destinations, redirects and not-found errors resolve to the installation of the route that uses them; `HostedRouter` types the links of code that mounts modules under path params. Type composition is contract-based through `./route-types`; the framework packages augment `@tanstack/router-core/extensions` and export `RouteCore`.

Start: modules get `createServerFn`, `createMiddleware` and `createStartModule` in their scope, declare required context by augmenting `StartModuleRequirements`, and contribute fragments that applications install with `createStart(() => ({ extends: startModules }))`; `startModules.gen.ts` type-checks installation and requirements. The Start plugin lists module routes in the routes manifest, selects the providers' client tree views, discovers prerenderable module pages and extends import protection to module packages.

Build and tooling: the host bundler compiles, code-splits and hot-updates module routes, including every installation; `tsr generate` and `tsr watch` are the only commands and packages own their declaration builds; the devtools show modules; the `route-module-imports` ESLint rule enforces scope imports. Fixtures cover React, Solid, Vue and Start with Vite and Rsbuild, and a large example measures builds.
History 2026-11-02 00:02:35 +01:00
..
authentication-overview.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
authentication-server-primitives.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
authentication.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
cdn-asset-urls.md docs: remove duplicate Router and Start page headings (#8339) 2026-09-10 12:32:59 +02:00
client-entry-point.md docs: remove duplicate Router and Start page headings (#8339) 2026-09-10 12:32:59 +02:00
code-execution-patterns.md docs: correct local relative links (#6027) 2025-12-05 22:39:47 +11:00
css-styling.md docs (#7520) 2026-06-01 21:46:55 +02:00
databases.md docs(start): describe key search entry pages (#8367) 2026-09-11 14:47:42 -06:00
deferred-hydration.md docs: use new query methods (#7100) 2026-10-06 17:59:20 +02:00
early-hints.md perf: lower manifest script preload priority (#8212) 2026-10-16 15:35:33 +02:00
environment-functions.md docs: Move files to Guides section (#5441) 2025-10-11 17:53:56 +02:00
environment-variables.md docs: Update environment variable validation to use z.url() (#5570) 2026-07-17 20:47:19 +02:00
error-boundaries.md docs: Fix frontmatter title field (#6753) 2026-02-24 20:28:51 +01:00
execution-model.md rename inputValidator to validator (#7566) 2026-06-06 23:05:56 +02:00
geo.md docs(start): rename LLM optimization guide to GEO (#7620) 2026-06-12 11:24:22 -06:00
hosting.md chore: remove experimental Nitro v2 Vite plugin (#8537) 2026-10-13 00:42:07 +02:00
hydration-errors.md docs: correct local relative links (#6027) 2025-12-05 22:39:47 +11:00
import-protection.md Start stable (#8696) 2026-10-13 00:45:16 +02:00
isr.md docs(start): fix tutorial and ISR guide links (#8366) 2026-09-11 14:36:09 -06:00
middleware.md rename inputValidator to validator (#7566) 2026-06-06 23:05:56 +02:00
observability.md rename inputValidator to validator (#7566) 2026-06-06 23:05:56 +02:00
path-aliases.md Start stable (#8696) 2026-10-13 00:45:16 +02:00
production-checklist.md docs(start): add production release checklist (#8373) 2026-09-11 17:14:04 -06:00
rendering-markdown.md docs(start): use TanStack Markdown in rendering guide (#8808) 2026-10-24 14:38:14 -06:00
route-modules.md feat: experimental route modules for file-based routing 2026-11-02 00:02:35 +01:00
routing.md docs: remove gitignore suggestion for generated route tree file (#6025) 2025-12-05 22:05:19 +01:00
selective-ssr.md docs: correct local relative links (#6027) 2025-12-05 22:39:47 +11:00
seo.md docs(start): describe key search entry pages (#8367) 2026-09-11 14:47:42 -06:00
server-components.md Start stable (#8696) 2026-10-13 00:45:16 +02:00
server-entry-point.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
server-functions.md response reconciliation (#7588) 2026-10-13 00:01:04 +02:00
server-routes.md docs(start): clarify server functions vs server routes (#7651) 2026-06-18 12:49:10 +02:00
spa-mode.md docs (#7520) 2026-06-01 21:46:55 +02:00
static-prerendering.md docs (#7520) 2026-06-01 21:46:55 +02:00
static-server-functions.md docs: Move files to Guides section (#5441) 2025-10-11 17:53:56 +02:00
streaming-data-from-server-functions.md docs: Move files to Guides section (#5441) 2025-10-11 17:53:56 +02:00
tailwind-integration.md docs (#7521) 2026-06-01 22:05:37 +02:00
tanstack-query.md docs(start): add tested TanStack Query integration guide (#8372) 2026-09-11 17:13:58 -06:00