
Tanstack Start
- 15 installs
- 35 repo stars
- Updated August 4, 2026
- hashintel/labs
Provides TanStack Start full-stack React patterns for file-based routing, layout routes, API/server handlers, and AI/MCP integration.
About
A framework skill covering TanStack Start conventions like route file types, layout routes with Outlet, and api.*.ts server handlers. A developer uses it when building or reviewing routing and server code in a TanStack Start app.
- File-based routing conventions including __root, dynamic $param, and layout routes
- Server handler naming via api.*.ts and committed routeTree.gen.ts
Tanstack Start by the numbers
- 15 all-time installs (skills.sh)
- Ranked #1,609 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hashintel/labs --skill tanstack-startAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 15 |
|---|---|
| repo stars | ★ 35 |
| Last updated | August 4, 2026 |
| Repository | hashintel/labs ↗ |
What it does
Provides TanStack Start full-stack React patterns for file-based routing, layout routes, API/server handlers, and AI/MCP integration.
Files
TanStack Start
File-Based Routing
Routes live in src/routes/. The route tree auto-generates to src/routeTree.gen.ts - commit this file (required for type-checking).
Route Types
__root.tsx- Root layout, wraps all routesindex.tsx- Index route for a path segmentdemo.tsx- Layout route wrapping alldemo/*.tsxchildren (uses<Outlet />)demo/*.tsx- Child routes rendered inside parent layout$param.tsx- Dynamic route segment
Layout Routes
Create foo.tsx alongside foo/ directory to wrap child routes:
import { createFileRoute, Outlet } from '@tanstack/react-router'
export const Route = createFileRoute('/foo')({
component: FooLayout,
})
function FooLayout() {
return (
<div>
<Outlet />
</div>
)
}API Routes
Server handlers use api.*.ts naming convention:
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/demo/api/example')({
server: {
handlers: {
POST: async ({ request }) => {
const data = await request.json()
return Response.json({ result: data })
},
},
},
})AI Chat Integration
Client Side
Use @ai-sdk/react with DefaultChatTransport:
import { useChat } from '@ai-sdk/react'
import { DefaultChatTransport } from 'ai'
const { messages, sendMessage } = useChat({
transport: new DefaultChatTransport({
api: '/demo/api/chat',
}),
})Server Side
Use streamText from ai package with OpenRouter provider:
import { convertToModelMessages, streamText } from 'ai'
import { haiku } from '@/lib/openrouter'
const result = await streamText({
model: haiku,
messages: convertToModelMessages(messages),
system: SYSTEM_PROMPT,
tools,
})
return result.toUIMessageStreamResponse()OpenRouter Setup
Create provider singleton in src/lib/openrouter.ts:
import { createOpenRouter } from '@openrouter/ai-sdk-provider'
export const openrouter = createOpenRouter({
apiKey: process.env.OPENROUTER_API_KEY,
})
export const haiku = openrouter('anthropic/claude-3.5-haiku')MCP Server
Register tools with Zod schemas in route files:
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import z from 'zod'
import { handleMcpRequest } from '@/utils/mcp-handler'
const server = new McpServer({ name: 'my-server', version: '1.0.0' })
server.registerTool(
'toolName',
{
title: 'Tool Title',
description: 'Tool description',
inputSchema: { param: z.string().describe('Param description') },
},
({ param }) => ({
content: [{ type: 'text', text: result }],
}),
)
export const Route = createFileRoute('/mcp')({
server: {
handlers: {
POST: async ({ request }) => handleMcpRequest(request, server),
},
},
})Path Aliases
@/* maps to ./src/* (configured in tsconfig.json).