TanStack Start Skills
Overview
TanStack Start is a full-stack React framework built on TanStack Router, powered by Vite and Nitro (via Vinxi). It provides server-side rendering, streaming, server functions (RPC), middleware, API routes, and deploys to any platform via Nitro presets.
Package: @tanstack/react-start
Router Plugin: @tanstack/router-plugin
Build Tool: Vinxi (Vite + Nitro)
Status: RC (Release Candidate)
RSC Support: React Server Components support is in active development and will land as a non-breaking v1.x addition
Installation & Project Setup
Project Structure
Configuration (app.config.ts)
Server Functions (createServerFn)
Server functions provide type-safe RPC calls between client and server.
Basic Server Functions
With Zod Validation
Middleware
Creating Middleware
Auth Middleware with Context
Chaining Middleware
API Routes (Server Routes)
SSR Strategies
Streaming SSR (Default)
Deployment
Supported Platforms (Nitro Presets)
Best Practices
- Use validators for all server function inputs - runtime safety and TypeScript inference
- Compose middleware for cross-cutting concerns (auth, logging, rate limiting)
- Use
createServerFnGET for data fetching (cacheable, preloadable) - Use
createServerFnPOST for mutations and side effects - Use
beforeLoadfor route-level auth guards - Use
defer()for non-critical data to improve TTFB - Set
defaultPreload: 'intent'on the router for instant navigation - Co-locate server functions with the routes that use them
Common Pitfalls
- Server functions cannot close over client-side variables (they're extracted to separate bundles)
- Data returned from server functions must be serializable
- Forgetting
awaitin loaders leads to streaming issues - Importing server-only code in client bundles causes build errors
- Missing
declare module '@tanstack/react-router'loses all type safety


