TanStack Router
repository·main·Indexed 12 days ago
https://github.com/TanStack/routerA type-safe routing library for modern web applications. The project also includes TanStack Start, a full-stack framework built upon the router to provide SSR and server-side capabilities.
What's inside TanStack Router
- TanStack Router is a router designed for building React and Solid applications. It focuses on providing a highly type-safe developer experience with features like 100% inferred TypeScript support, nested routing, and built-in SWR caching for loaders. It is designed to work seamlessly with client-side data caches like TanStack Query or SWR.
What is TanStack Router?
mainTanStack Router is a modern router designed for type safety, data-driven navigation, and an enhanced developer experience. Key features include:
- End-to-end type safety: Full type safety for routes, parameters, and loaders.
- Schema-driven search params: Validation for search parameters using schemas.
- Built-in data management: Includes caching, prefetching, and invalidation mechanisms.
- Advanced UI patterns: Supports nested layouts, transitions, and error boundaries.
Overview of TanStack Solid Start
mainTanStack Solid Start is a full-stack framework for SolidJS. It provides Server-Side Rendering (SSR), streaming, server functions, API routes, and bundling, all powered by TanStack Router and Vite. It is designed to be ready for deployment to various hosting providers.Overview of SSR Streaming and File-Based Routing Example
mainThis example serves as a reference implementation for several advanced TanStack Router features:
- Server-side rendering (SSR) with streaming: Delivering HTML in chunks to improve perceived performance.
- File-based routing: Automatically generating route configurations based on the file system structure.
- Progressive rendering: Rendering parts of the UI as they become available.
- Suspense boundaries: Managing loading states for asynchronous data or components.
- Optimized time-to-first-byte (TTFB): Improving server response speed through streaming techniques.
Overview of TanStack Start
mainTanStack Start is a full-stack React framework built on TanStack Router and Vite. It provides a unified development experience by adding SSR (Server-Side Rendering), streaming, type-safe RPCs (Server Functions), middleware, server routes, and universal deployment capabilities.
Key architectural principle: All code is isomorphic by default, meaning it runs in both server and client environments unless explicitly constrained. This requires careful management of environment boundaries, especially when handling secrets or server-only logic.
Overview of TanStack React Router
mainTanStack React Router is a type-safe router for React applications. It features built-in caching and robust URL state management. It is designed to provide a highly developer-friendly experience through strong TypeScript integration.
For comprehensive documentation, guides, and API references, visit the official website at tanstack.com/router.
Overview of TanStack Vue Router
mainTanStack Vue Router is a type-safe router designed for Vue applications. It features built-in caching and robust URL state management. It is part of the TanStack ecosystem and provides high-fidelity type safety for route parameters, search queries, and more.What is demonstrated in the Kitchen Sink React Query example
mainThis example serves as a reference implementation for several advanced TanStack patterns, including:
- File-based routing: Using TanStack Router's automatic route generation.
- TanStack Query integration: Combining routing with data fetching.
- Type-safe data fetching: Ensuring end-to-end type safety from route to data.
- Advanced routing patterns: Handling complex data loading and cache management scenarios.
What is TanStack Start?
mainTanStack Start is a full-stack framework built on top of TanStack Router. It is designed for server-side rendering (SSR), streaming, and production-ready deployments. It provides:
- Full-document SSR & streaming: Optimized for server-side rendering and data streaming.
- Server functions: End-to-end type safety for server-side logic.
- Deployment-ready: Bundling and build processes optimized for production.
- Full-stack capabilities: Extends all features of TanStack Router into a complete framework.
Overview of Kitchen Sink React Query patterns
mainThis example serves as a reference implementation for integrating TanStack Router with TanStack Query. It is designed to demonstrate high-complexity scenarios including:
- Advanced Routing: Complex TanStack Router patterns.
- Data Fetching: Integration of TanStack Query for complex data fetching scenarios.
- State & Cache: Cache management and optimistic updates.
- UX Patterns: Handling error states and loading states within a routed application.
Overview of TanStack Router Capabilities
mainTanStack Router is a type-safe router designed for React and Solid applications. It features built-in SWR caching, JSON-first search parameters, file-based route generation, and end-to-end type inference. The router is client-first and isomorphic: loaders execute on the client by default and on the server when used in conjunction with TanStack Start.Overview of TanStack Start features and dependencies
mainTanStack Start is a full-stack React framework powered by TanStack Router. It is designed for building high-performance web applications with features like full-document SSR, streaming, and server functions.
Core Dependencies
- TanStack Router: Provides the type-safe routing system (nested routing, search params, data loading).
- Vite or Rsbuild: Modern build tools used for development (HMR) and optimized production builds.
Key Capabilities
- Full-stack capabilities: Includes Server Functions (type-safe RPCs), Server/API routes, and Middleware.
- Deployment: Supports universal deployment to various hosting providers and runtimes via Vite or Rsbuild.
- Experimental Support: React Server Components (RSC) are available as an experimental feature.