Skip to main content
skill CX Codex

deployment · tanstack — Claude Code skill: deploy TanStack Start apps

deployment deploys TanStack Start to Cloudflare Workers, Netlify, Vercel, Node.js, Bun, and Railway. Controls SSR per route, static prerendering, and SEO config.

MIT 210 installs ★ 15,341 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add TanStack/router --skill deployment -a claude-code
Open on GitHub

What deployment does

The skill sets up deployment for each platform: installs plugins in vite.config.ts, writes hosting config (wrangler.jsonc for Cloudflare, Nitro preset for Vercel and Docker), and provides build commands. It switches SSR per route — full server rendering (ssr: true), data-only mode (data-only), or client-only (ssr: false). It generates static pages from dynamic paths via crawlLinks and configures meta tags, Open Graph, and JSON-LD in the route's head function.

Cloudflare Workers deployment writes the nodejs_compat flag in wrangler.jsonc — without it, Node.js modules fail at runtime. Bun requires React 19; React 18 projects use Node.js deployment. The functional ssr form lets you decide rendering location based on request params.

What it helps with

  • deploy TanStack Start to Cloudflare Workers or Vercel
  • disable SSR for a canvas or WebGL route
  • generate static HTML from a list of posts
  • add meta tags and Open Graph from loader data
  • set up JSON-LD for article SEO

Example prompts for the agent

  • Set up Cloudflare Workers deployment with the nodejs_compat flag
  • Make the /dashboard route client-only, no SSR needed
  • Add meta tags and og:image from post data in head

How to install deployment

1Skills CLI (Vercel)

npx skills add TanStack/router --skill deployment -a claude-code

2Manually: put the files in place

~/.claude/skills/deployment/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/deployment/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about deployment

How do I install deployment in Claude Code?

Run npx skills add TanStack/router --skill deployment -a claude-code, the skill appears in ~/.claude/skills/deployment/SKILL.md.

What does the deployment skill do?

It configures TanStack Start deployment to six platforms, controls SSR per route, generates static pages, and writes SEO tags via the route's head function.

Why does Cloudflare Workers need nodejs_compat?

Without the nodejs_compat flag in wrangler.jsonc, Node.js modules throw runtime errors. The skill adds this flag to the config automatically.

Source text

SKILL.md · MIT
---
name: deployment
description: >-
  Deploy to Cloudflare Workers, Netlify, Vercel, Node.js/Docker,
  Bun, Railway. Selective SSR (ssr option per route), SPA mode,
  static prerendering, ISR with Cache-Control headers, SEO and
  head management.
metadata:
  type: sub-skill
  library: tanstack-start
  library_version: '1.170.14'
requires:
  - start-core
sources:
  - TanStack/router:docs/start/framework/react/guide/hosting.md
  - TanStack/router:docs/start/framework/react/guide/selective-ssr.md
  - TanStack/router:docs/start/framework/react/guide/static-prerendering.md
  - TanStack/router:docs/start/framework/react/guide/seo.md
---

# Deployment and Rendering

TanStack Start deploys to any hosting provider via Vite and Nitro. This skill covers hosting setup, SSR configuration, prerendering, and SEO.

## Hosting Providers

### Cloudflare Workers

```bash
pnpm add -D @cloudflare/vite-plugin wrangler
```

```ts
// vite.config.ts
import { defineConfig } from 'vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import { cloudflare } from '@cloudflare/vite-plugin'
import viteReact from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [
    cloudflare({ viteEnvironment: { name: 'ssr' } }),
    tanstackStart(),
    viteReact(),
  ],
})
```

```jsonc
// wrangler.jsonc
{
  "name": "my-app",
  "compatibility_date": "2025-09-02",
  "compatibility_flags": ["nodejs_compat"],
  "main": "@tanstack/react-start/server-entry",
}
```

Deploy: `npx wrangler login && pnpm run deploy`

> **Worker env is per-request.** Cloudflare Workers inject env vars at request time. `process.env.X` at module scope evaluates to `undefined` even on the server. The Cloudflare-canonical way to read env (including from module scope) is the `cloudflare:workers` env binding:
>
> ```ts
> import { env } from 'cloudflare:workers'
> const apiHost = env.API_HOST
> ```
>
> Or read `process.env.X` per-request inside `.handler()` / middleware `.server()`. See [Cloudflare's environment-variables docs](https://developers.cloudflare.com/workers/configuration/environment-variables/) and [start-core/execution-model](../execution-model/SKILL.md).

### Netlify

```bash
pnpm add -D @netlify/vite-plugin-tanstack-start
```

```ts
// vite.config.ts
import { defineConfig } from 'vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import netlify from '@netlify/vite-plugin-tanstack-start'
import viteReact from '@vitejs/plugin-react'

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

Deploy: `npx netlify deploy`

### Nitro (Vercel, Railway, Node.js, Docker)

```bash
npm install nitro@npm:nitro-nightly@latest
```

```ts
// vite.config.ts
import { defineConfig } from 'vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import { nitro } from 'nitro/vite'
import viteReact from '@vitejs/plugin-react'

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

Build and start: `npm run build && node .output/server/index.mjs`

### Bun

Bun deployment requires React 19. For React 18, use Node.js deployment.

```ts
// vite.config.ts — add bun preset to nitro
plugins: [tanstackStart(), nitro({ preset: 'bun' }), viteReact()]
```

## Selective SSR

Control SSR per route with the `ssr` property.

### `ssr: true` (default)

Runs `beforeLoad` and `loader` on server, renders component on server:

```tsx
export const Route = createFileRoute('/posts/$postId')({
  ssr: true, // default
  loader: () => fetchPost(), // runs on server during SSR
  component: PostPage, // rendered on server
})
```

### `ssr: false`

Disables server execution of `beforeLoad`/`loader` and server rendering:

```tsx
export const Route = createFileRoute('/dashboard')({
  ssr: false,
  loader: () => fetchDashboard(), // runs on client only
  component: DashboardPage, // rendered on client only
})
```

### `ssr: 'data-only'`

Runs `beforeLoad`/`loader` on server but renders component on client only:

```tsx
export const Route = createFileRoute('/canvas')({
  ssr: 'data-only',
  loader: () => fetchCanvasData(), // runs on server
  component: CanvasPage, // rendered on client only
})
```

### Functional Form

Decide SSR at runtime based on params/search:

```tsx
export const Route = createFileRoute('/docs/$docType/$docId')({
  ssr: ({ params }) => {
    if (params.status === 'success' && params.value.docType === 'sheet') {
      return false
    }
  },
})
```

### SSR Inheritance

Children inherit parent SSR config and can only be MORE restrictive:

- `true` → `data-only` or `false` (allowed)
- `false` → `true` (NOT allowed — parent `false` wins)

### Default SSR

Change the default for all routes in `src/start.ts`:

```tsx
import { createStart } from '@tanstack/react-start'

export const startInstance = createStart(() => ({
  defaultSsr: false,
}))
```

## Static Prerendering

Generate static HTML at build time:

```ts
// vite.config.ts
tanstackStart({
  prerender: {
    enabled: true,
    crawlLinks: true,
    concurrency: 14,
    failOnError: true,
  },
})
```

Static routes are auto-discovered. Dynamic routes (e.g. `/users/$userId`) require `crawlLinks` or explicit `pages` config.

## SEO and Head Management

### Basic Meta Tags

```tsx
export const Route = createFileRoute('/')({
  head: () => ({
    meta: [
      { title: 'My App - Home' },
      { name: 'description', content: 'Welcome to My App' },
    ],
  }),
})
```

### Dynamic Meta from Loader Data

```tsx
export const Route = createFileRoute('/posts/$postId')({
  loader: async ({ params }) => fetchPost(params.postId),
  head: ({ loaderData }) => ({
    meta: [
      { title: loaderData.title },
      { name: 'description', content: loaderData.excerpt },
      { property: 'og:title', content: loaderData.title },
      { property: 'og:image', content: loaderData.coverImage },
    ],
  }),
})
```

### Structured Data (JSON-LD)

```tsx
head: ({ loaderData }) => ({
  scripts: [
    {
      type: 'application/ld+json',
      children: JSON.stringify({
        '@context': 'https://schema.org',
        '@type': 'Article',
        headline: loaderData.title,
      }),
    },
  ],
})
```

### Dynamic Sitemap via Server Route

```ts
// src/routes/sitemap[.]xml.ts
export const Route = createFileRoute('/sitemap.xml')({
  server: {
    handlers: {
      GET: async () => {
        const posts = await fetchAllPosts()
        const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  ${posts.map((p) => `<url><loc>https://myapp.com/posts/${p.id}</loc></url>`).join('')}
</urlset>`
        return new Response(sitemap, {
          headers: { 'Content-Type': 'application/xml' },
        })
      },
    },
  },
})
```

## Common Mistakes

### 1. HIGH: Missing nodejs_compat flag for Cloudflare Workers

```jsonc
// WRONG — Node.js APIs fail at runtime
{ "compatibility_flags": [] }

// CORRECT
{ "compatibility_flags": ["nodejs_compat"] }
```

### 2. MEDIUM: Bun deployment with React 18

Bun-specific deployment only works with React 19. Use Node.js deployment for React 18.

### 3. MEDIUM: Child route loosening parent SSR config

```tsx
// Parent sets ssr: false
// WRONG — child cannot upgrade to ssr: true
const parentRoute = createFileRoute('/dashboard')({ ssr: false })
const childRoute = createFileRoute('/dashboard/stats')({
  ssr: true, // IGNORED — parent false wins
})

// CORRECT — children can only be MORE restrictive
const parentRoute = createFileRoute('/dashboard')({ ssr: 'data-only' })
const childRoute = createFileRoute('/dashboard/stats')({
  ssr: false, // OK — more restrictive than parent
})
```

## Cross-References

- [start-core/server-routes](../server-routes/SKILL.md) — API endpoints for sitemaps, robots.txt
- [start-core/execution-model](../execution-model/SKILL.md) — SSR affects where code runs

© TanStack · MIT · TanStack/router

Similar skills

All skills for Frontend and UI →

deployment by other authors comes first.

deployment Railway deployment is a Claude Code skill that controls Railway deployments, fetches build logs, and restarts containers. It runs during runtime crash diagnostics or when stopping active releases. CX Codex +1 69installs Deployment Advisor daffy0208 Deployment Advisor guides infrastructure selection and CI/CD setup based on runtime requirements, database needs, and traffic scale. CX Codex +1 145installs vercel-deployment curiositech vercel-deployment — a skill that handles Vercel deploys for Next.js and React apps: env vars, edge functions, build fixes, preview deployments. Not for AWS, GCP or Azure. CX Codex +1 187installs ship-deployment Community The ship-deployment command completes the deployment half of /ship: it tracks Railway, Vercel or Netlify releases through dev checks and production, and reverts the merge if production fails. CX Codex +1 ★ 2,003repo stars tanstack-start tanstack-skills Guides agents through building full-stack React apps with TanStack Start, streaming SSR, and type-safe server functions. CX Codex +1 4,000installs tanstack-integration-best-practices DeckardGer tanstack-integration-best-practices — a skill that hands the agent rules for wiring TanStack Query, Router and Start together: loaders, SSR hydration, cache ownership. Useful once all three live in one codebase. CX Codex +1 3,100installs tanstack-start-cursorrules-prompt-file PatrickJS tanstack-start-cursorrules-prompt-file — a Cursor rule for TanStack Start, a full-stack React framework with SSR, server functions and type safety. Triggers when you work on Start projects, TanStack Router routes or Vinxi config files. CX Codex +1 ★ 41,178repo stars

From the same set25

The whole set →
navigation This skill guides TanStack Router navigation with links, programmatic transitions, route preloading, and protection against leaving dirty forms. CX Codex +1 214installs execution-model The execution-model skill teaches agents to separate server and browser code in TanStack Start, with SSR, hydration, imports, and environment variables in view. CX Codex +1 214installs code-splitting code-splitting — a skill for TanStack Router that splits route code into critical (config, loaders) and lazy (components). Automatically generates separate chunks per route, or manually control splitting with .lazy.tsx files. CX Codex +1 212installs not-found-and-errors not-found-and-errors teaches coding agents to configure 404 boundaries and error components in TanStack Router. It covers throwing notFound() and handling loader failures. CX Codex +1 211installs path-params path-params — a skill for handling dynamic URL parameters in TanStack Router. Teaches agents to capture variable path segments, set up optional routes, and create patterns with prefixes and suffixes. CX Codex +1 208installs middleware Covers TanStack Start middleware: createMiddleware, context chaining via next(), sendContext for cross-boundary transfers, and global registration in src/start.ts. CX Codex +1 206installs server-routes This skill guides an agent through API endpoints in TanStack Router, including HTTP handlers and request parsing. Use it when routes need an HTTP contract. CX Codex +1 205installs ssr The ssr skill for Claude Code configures streaming or non-streaming server-side rendering in TanStack Router for projects integrating the router with an existing server. CX Codex +1 202installs

Project sponsors

Companies that keep this analytics open