Skip to main content

Prerequisites

Before installing TanStack Start, ensure you have:
  • Node.js: Version 22.12.0 or higher
  • Package Manager: npm, yarn, or pnpm
  • Vite: Version 7.0.0 or higher (installed automatically)
TanStack Start requires Node.js 22.12.0 or higher. Make sure to update your Node.js version before proceeding.

Choose Your Framework

TanStack Start is available for React, Solid, and Vue. Select your framework below:

React Installation

Install TanStack Start for React along with its peer dependencies:
npm install @tanstack/react-start @tanstack/react-router

Peer Dependencies

TanStack Start for React requires:
  • react >= 18.0.0 or >= 19.0.0
  • react-dom >= 18.0.0 or >= 19.0.0
  • vite >= 7.0.0
These should be installed in your project:
npm install react react-dom vite

Development Dependencies

For TypeScript support and optimal development experience:
npm install -D @types/react @types/react-dom typescript

Optional: Router Devtools

For debugging and inspecting your router state:
npm install @tanstack/react-router-devtools

Vite Configuration

After installing the packages, configure Vite to use the TanStack Start plugin:
Create or update your vite.config.ts:
vite.config.ts
import { defineConfig } from 'vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
import { nitro } from 'nitro/vite'

export default defineConfig({
  plugins: [
    tanstackStart(),
    viteReact(),
    nitro(),
  ],
})

Plugin Order

The plugin order is important:
  1. tanstackStart() - Must come first to transform server functions
  2. viteReact() - React plugin for JSX transformation
  3. nitro() - Server bundling and deployment

TypeScript Configuration

For optimal TypeScript support, configure your tsconfig.json:
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "jsx": "react-jsx",
    "strict": true,
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "types": ["vite/client"]
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}

Package Scripts

Add these scripts to your package.json:
package.json
{
  "scripts": {
    "dev": "vite dev",
    "build": "vite build",
    "preview": "vite preview",
    "start": "node .output/server/index.mjs"
  }
}
  • dev: Starts the development server with hot module replacement
  • build: Builds the production application
  • preview: Previews the production build locally
  • start: Runs the production server (after build)

Nitro Installation

TanStack Start uses Nitro for server bundling and deployment. Install it as a dev dependency:
npm install -D nitro
Nitro provides:
  • Universal deployment adapters
  • Auto-detected platform configuration
  • Production-optimized server builds
  • Support for serverless and edge runtimes

Directory Structure

Create the following directory structure for your project:
my-app/
├── src/
│   ├── routes/           # File-based routes
│   │   ├── __root.tsx    # Root route
│   │   └── index.tsx     # Home page
│   ├── router.tsx        # Router configuration
│   └── routeTree.gen.ts  # Generated route tree
├── public/               # Static assets
├── vite.config.ts        # Vite configuration
├── tsconfig.json         # TypeScript configuration
└── package.json          # Package manifest

Verification

Verify your installation by checking the installed versions:
npm list @tanstack/react-start @tanstack/react-router
# or
npm list @tanstack/solid-start @tanstack/solid-router
# or
npm list @tanstack/vue-start @tanstack/vue-router
You should see version 1.166.1 or higher.

Next Steps

Quickstart Tutorial

Build your first TanStack Start application with server functions

Server Functions

Learn how to create and use server functions

SSR Setup

Configure server-side rendering for your app

Deployment

Deploy your application to production

Build docs developers (and LLMs) love