Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

tanstack-start

БесплатноБез исполняемых скриптовНе проверен

Build full-stack React apps with TanStack Start. Use when a user asks to create a full-stack React application with type-safe server functions, set up…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

TanStack Start

Overview

TanStack Start is a full-stack React framework built on TanStack Router and Vite (Rsbuild is also supported). It provides type-safe server functions (createServerFn), file-based routes with loaders, middleware, server routes for raw HTTP endpoints, and per-route control of SSR, prerendering and SPA behavior. In v1 Start is a Vite plugin (tanstackStart()), not a Vinxi app: there is no app.config.ts, and routes live in src/routes. Checked against @tanstack/react-start 1.169 (October 2026).

Instructions

Step 1: Project setup

Scaffold with the official CLI (it asks for package manager and add-ons), or start from an example:

npx @tanstack/cli@latest create
npx gitpick TanStack/router/tree/main/examples/react/start-basic start-basic

By hand: npm i @tanstack/react-start @tanstack/react-router react react-dom, then npm i -D vite @vitejs/plugin-react typescript @types/react @types/react-dom @types/node, set "type": "module" and scripts "dev": "vite dev", "build": "vite build".

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

export default defineConfig({
  server: { port: 3000 },
  resolve: { tsconfigPaths: true },
  plugins: [
    tanstackStart(),
    viteReact(), // must come after tanstackStart()
  ],
})
my-app/
├── src/
│   ├── routes/
│   │   ├── __root.tsx          # root layout (html shell)
│   │   ├── index.tsx           # /
│   │   └── health.ts           # server route: /health
│   ├── utils/                  # server functions, middleware
│   ├── router.tsx              # exports getRouter()
│   └── routeTree.gen.ts        # generated on first dev/build, do not edit
├── vite.config.ts
└── tsconfig.json

Keep verbatimModuleSyntax off; it can leak server code into the client bundle.

// src/router.tsx
import { createRouter } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen'

export function getRouter() {
  return createRouter({ routeTree, scrollRestoration: true })
}
// src/routes/__root.tsx
import { Outlet, createRootRoute, HeadContent, Scripts } from '@tanstack/react-router'

export const Route = createRootRoute({
  head: () => ({
    meta: [{ charSet: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { title: 'Northwind Journal' }],
  }),
  component: () => (
    <html>
      <head><HeadContent /></head>
      <body><Outlet /><Scripts /></body>
    </html>
  ),
})

Step 2: Server functions

createServerFn defines logic that runs only on the server and is callable from loaders, components and event handlers. The input schema goes in .validator() (not .inputValidator(), which does not exist in v1). A Zod 4 schema can be passed directly; a plain function (d: T) => d also works.

// src/utils/posts.functions.ts
import { createServerFn } from '@tanstack/react-start'
import { notFound } from '@tanstack/react-router'
import { z } from 'zod'
import { authMiddleware } from './auth'
import { db } from './db.server' // your own DB module

export const getPosts = createServerFn({ method: 'GET' })
  .validator(z.object({ limit: z.number().min(1).max(100).default(20) }))
  .handler(async ({ data }) => db.posts.latest(data.limit))
export const getPost = createServerFn({ method: 'GET' })
  .validator(z.object({ id: z.string() }))
  .handler(async ({ data }) => {
    const post = await db.posts.find(data.id)
    if (!post) throw notFound()
    return post
  })

export const createPost = createServerFn({ method: 'POST' })
  .middleware([authMiddleware])
  .validator(z.object({ title: z.string().min(1).max(200), body: z.string().min(1) }))
  .handler(async ({ data, context }) => db.posts.insert({ ...data, authorId: context.user.id }))

Call one as getPosts({ data: { limit: 10 } }); input always comes from the network, so keep the validator. In components wrap it with useServerFn(createPost) so redirects and notFound() thrown on the server are handled by the router. Put database access in modules the client never imports (for example *.server.ts) and import them only from inside handlers.

Step 3: Routes with loaders

// src/routes/index.tsx
import { createFileRoute, Link } from '@tanstack/react-router'
import { getPosts } from '~/utils/posts.functions'

export const Route = createFileRoute('/')({
  loader: () => getPosts({ data: { limit: 10 } }),
  component: Home,
})

function Home() {
  const posts = Route.useLoaderData()
  return (
    <ul>
      {posts.map((p) => (
        <li key={p.id}><Link to="/posts/$postId" params={{ postId: p.id }}>{p.title}</Link></li>
      ))}
    </ul>
  )
}
// src/routes/posts/$postId.tsx
import { createFileRoute } from '@tanstack/react-router'
import { getPost } from '~/utils/posts.functions'

export const Route = createFileRoute('/posts/$postId')(
Полный SKILL.md на GitHub

Установить tanstack-start в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл tanstack-start?

Build full-stack React apps with TanStack Start. Use when a user asks to create a full-stack React application with type-safe server functions, set up file-based routing with SSR/SSG/SPA modes, build APIs with middleware and validation, implement server-side data fetching with TanStack Router, or deploy to Cloudflare/Netlify/Vercel/Node.

Как установить скилл tanstack-start?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл tanstack-start запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить tanstack-start с