Installation
TanStack Start is built on top of Vite, providing a fast and modern development experience. This guide will walk you through setting up a new TanStack Start project.Requirements
Before you begin, make sure you have:- Node.js 22.12.0 or later - Start requires Node.js version 22.12.0+
- npm, pnpm, yarn, or bun - Any package manager will work
Creating a New Project
The fastest way to get started is to use the TanStack Start CLI:Manual Installation
If you prefer to set up a project manually or add Start to an existing project, follow these steps:1. Install Dependencies
Install the required packages:2. Configure Vite
Create avite.config.ts file in your project root:
tanstackStart plugin handles:
- Route generation from your file structure
- Code splitting between client and server
- Server entry point generation
- TypeScript type generation
3. Configure TypeScript
Create or update yourtsconfig.json:
tsconfig.node.json for Node.js/Vite config files:
4. Update package.json
Add the required scripts to yourpackage.json:
"type": "module" field—TanStack Start uses ES modules.
Project Structure
A typical TanStack Start project has the following structure:The src/routes Directory
This is where you define your routes using file-based routing:
__root.tsx- The root layout for your entire appindex.tsx- The home page (/)about.tsx- An about page (/about)posts/$postId.tsx- A dynamic route (/posts/:postId)
Configuration Options
ThetanstackStart plugin accepts several options: