/fuse-tanstack-start:start-server-routesfrom fuse-tanstack-start
Builds raw HTTP endpoints in TanStack Start using the server property on createFileRoute. Covers handlers, dynamic params, middleware, and dual UI/API routes. Use for webhooks, public REST, or cross-origin endpoints.
Ships in fuse-tanstack-start. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Documents the handler context ({ request, params, context, pathname, next }), dynamic ($id) and splat ($) params from the file name, per-handler middleware via createHandlers versus route-wide server.middleware, and how the same file can serve as both a UI route (component) and an API route (server) at once.
Critical rules: choose a server route over a server function when the endpoint must be callable from outside the app (webhooks, public REST, cross-origin) — see references/vs-server-functions.md for the decision; exactly one handler file may resolve to a given route path (routes/users.ts, routes/users/index.ts, and routes/users.index.ts all collide on /users); always await request.json()/.text()/.formData(); and handlers must return a Response (or Promise).
Includes a full REST-resource template with params and middleware.
Do NOT use this skill for internal type-safe RPC callable only from your own app (use start-server-functions), for reusable middleware chains (use start-middleware), or for UI route rendering.
Server routes are raw HTTP endpoints defined alongside app routes in
src/routes/. They use the server property on createFileRoute (imported
from @tanstack/react-router) and return standard Response objects. This skill
targets @tanstack/react-start v1.169.5.
Before implementing, verify current APIs against Context7
(/websites/tanstack_start_framework_react) + Exa, then explore the target
codebase. After changes, run fuse-ai-pilot:sniper.
routes/users.ts, routes/users/index.ts,
and routes/users.index.ts all resolve to /users and error if duplicated.await body methods. request.json(), .text(), .formData()
return Promises — un-awaited, you get a Promise, not the data.Response (or Promise<Response>). Use
Response.json(...) for JSON, or new Response(body, { status, headers }).component
alongside server.| Feature | Description |
|---|---|
| Definition | server: { handlers: { GET, POST, ... } } on createFileRoute |
| Handler context | { request, params, context, pathname, next } |
| Middleware | server.middleware (all handlers) or createHandlers (per handler) |
| Params | Dynamic ($id) and splat ($) from the file name |
src/routes/
├── api/
│ ├── hello.ts # /api/hello
│ ├── users/$id.ts # /api/users/$id (dynamic param)
│ └── file/$.ts # /api/file/$ (splat param)
└── webhooks/stripe.ts # /webhooks/stripe (external POST)
→ See rest-endpoint.md
| Topic | Reference | Load when |
|---|---|---|
| Defining routes | defining.md | Handlers, params, body, responses, middleware |
| Routes vs functions | vs-server-functions.md | Deciding between the two mechanisms |
| Template | When to Use |
|---|---|
| rest-endpoint.md | Full REST resource with params + middleware |
// src/routes/api/hello.ts
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/api/hello')({
server: {
handlers: {
GET: async ({ request }) => new Response('Hello, World!'),
},
},
})
// src/routes/api/users/$id.ts
export const Route = createFileRoute('/api/users/$id')({
server: {
handlers: {
GET: async ({ params }) => {
const user = await findUser(params.id)
if (!user) return new Response('Not found', { status: 404 })
return Response.json(user)
},
},
},
})
→ See defining.md for middleware and body parsing
Response.json() for JSON (sets Content-Type automatically)await every request body methodauthMiddleware on routes handling private dataResponseWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/solid-tanstack-startUse when organizing TanStack Start code, splitting oversized routes/server functions, or reviewing architecture. Do NOT use for setup or plain React SPA./start-authUse when adding auth to a TanStack Start app — route protection, server-function authorization, sessions, CSRF. Do NOT use for generic route guards./start-coreUse when scaffolding a TanStack Start project, wiring the build tool, or debugging setup (blank page, hydration, no client JS)./start-deploymentUse when building or deploying a TanStack Start app — Cloudflare, Netlify, Vercel/Node/Bun, prerendering, or env vars. Do NOT use for app logic or generic Vite config./start-execution-modelUse when deciding where TanStack Start code runs, fixing secret leaks, DB-in-loader bugs, or hydration mismatches./start-middlewareUse when composing cross-cutting server logic in TanStack Start with createMiddleware — chaining, context, auth factories.npx claudepluginhub fusengine/claude-plugins --plugin fuse-tanstack-startOther plugins' skills for the same job