Skip to main content
TanStack Start is a full-stack framework powered by TanStack Router. It supports full-document SSR, streaming, server functions, bundling and more, powered by TanStack Router and Vite.
1

Create a new TanStack Start app

Use the interactive CLI to create a new TanStack Start app.
terminal
bunx @tanstack/cli create my-tanstack-app
2

Start the dev server

Change to the project directory and run the dev server with Bun.
terminal
cd my-tanstack-app
bun --bun run dev
This starts the Vite dev server with Bun.
3

Update scripts in package.json

Modify the scripts field in your package.json by prefixing the Vite CLI commands with bun --bun. This ensures that Bun executes the Vite CLI for common tasks like dev, build, and preview.
package.json
{
  "scripts": {
    "dev": "bun --bun vite dev", 
    "build": "bun --bun vite build", 
    "serve": "bun --bun vite preview"
  }
}

Hosting

To host your TanStack Start app, you can use Nitro or a custom Bun server for production deployments.
1

Add Nitro to your project

Add Nitro to your project. This tool allows you to deploy your TanStack Start app to different platforms.
terminal
bun add nitro
2

Update your vite.config.ts file

Update your vite.config.ts file to include the necessary plugins for TanStack Start with Bun.
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/typescript.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=b76cf0e4a2c188862bc272cae1c4e52fvite.config.ts
// other imports...
import { nitro } from "nitro/vite"; 

const config = defineConfig({
  plugins: [
    tanstackStart(),
    nitro({ preset: "bun" }), 
    // other plugins...
  ],
});

export default config;
The bun preset is optional, but it configures the build output specifically for Bun’s runtime.
3

Update the start command

Make sure build and start scripts are present in your package.json file:
package.json
  {
    "scripts": {
      "build": "bun --bun vite build", 
      // The .output files are created by Nitro when you run `bun run build`.
      // Not necessary when deploying to Vercel.
      "start": "bun run .output/server/index.mjs"
    }
  }
You do not need the custom start script when deploying to Vercel.
4

Deploy your app

Check out one of our guides to deploy your app to a hosting provider.
When deploying to Vercel, you can either add the "bunVersion": "1.x" to your vercel.json file, or add it to the nitro config in your vite.config.ts file:
Do not use the bun Nitro preset when deploying to Vercel.
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/typescript.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=b76cf0e4a2c188862bc272cae1c4e52fvite.config.ts
export default defineConfig({
  plugins: [
    tanstackStart(),
    nitro({
      preset: "bun", 
      vercel: { 
        functions: { 
          runtime: "bun1.x", 
        }, 
    }, 
    }),
  ],
});
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/vercel.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=bc86562517240f04f1762aea70b1dbbf

Vercel

Deploy on Vercel
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/render.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=dd8d1eb5da476796d73f5b86e103c57c

Render

Deploy on Render
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/railway.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=c4c56e6e0031eee88e3eb173c7253960

Railway

Deploy on Railway
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/digitalocean.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=f1c3820cb479ff086deedbd1bd684b02

DigitalOcean

Deploy on DigitalOcean
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/aws.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=5fe2ebfa7d9e47ac3e16f28a4b9361d6

AWS Lambda

Deploy on AWS Lambda
https://mintcdn.com/bun-1dd33a4e-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/ecosystem/gcp.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=187f3aefdfc29b20217ae128961097f3

Google Cloud Run

Deploy on Google Cloud Run

Templates

bun-tanstack-todo

Todo App with Tanstack + Bun

A Todo application built with Bun, TanStack Start, and PostgreSQL.
bun-tanstack-basic

Bun + TanStack Start Application

A TanStack Start template using Bun with SSR and file-based routing.
bun-tanstack-start

Basic Bun + Tanstack Starter

The basic TanStack starter using the Bun runtime and Bun’s file APIs.

→ See TanStack Start’s official documentation for more information on hosting.