← Back to list

tanstack-router
by marthaya-putra
Movies and TV Shows tracker with AI recommendations
⭐ 0🍴 0📅 Jan 20, 2026
SKILL.md
name: tanstack-router description: TanStack Start specialist for file-based routing, SSR, and server functions with React
TanStack Router Specialist
Instructions
When working with TanStack Start:
-
Creating Routes
- Use
createFileRoute()insrc/routes/ - Export a
Routeobject with component - Use
index.tsxfor index routes - Create layout routes without
index.tsx
- Use
-
Server Functions
- Use
createServerFn()for server-side logic - Add validators with Zod schemas
- Specify method: 'POST' for mutations
- Import functions in components
- Use
-
Data Fetching
- Use loaders for fetching data
- Access data with
Route.useLoaderData() - Handle loading and error states
- Use suspense boundaries for async operations
- Streaming with
<Await>: Don't await slow operations in loader for better UX- Fast operations (e.g., DB queries) can be awaited
- Slow operations (e.g., AI, external APIs) should be returned as promises
- Use
<Suspense>with<Await>in components to stream results
-
SSR Setup
- Ensure root layout in
__root.tsx - Include
HeadContentandScripts - Handle authentication on server
- Pass data via loaders for SSR
- Ensure root layout in
Examples
Creating a basic route:
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/movies')({
component: MoviesPage,
loader: async () => {
const movies = await getMovies()
return { movies }
}
})
function MoviesPage() {
const { movies } = Route.useLoaderData()
return <div>{/* Render movies */}</div>
}
Creating a server function:
import { createServerFn } from '@tanstack/start'
import { z } from 'zod'
export const saveMovie = createServerFn({ method: 'POST' })
.validator(z.object({ movieId: z.number() }))
.handler(async ({ data }) => {
// Server-side logic
await saveToDatabase(data.movieId)
return { success: true }
})
Dynamic routing:
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/movies/$movieId')({
component: MovieDetail,
loader: async ({ params }) => {
const movie = await getMovie(params.movieId)
return { movie }
}
})
Streaming with <Await> for slow operations:
import { createFileRoute } from '@tanstack/react-router'
import { Suspense } from 'react'
import { Await } from '@tanstack/react-router'
export const Route = createFileRoute('/recommendations')({
component: Recommendations,
loader: async () => {
// Fast operation - await it
const userPrefs = await getUserPreferences()
// Slow operation - don't await for streaming
const recommendations = getAIRecommendations({ userPrefs })
return { userPrefs, recommendations }
}
})
function Recommendations() {
const { userPrefs, recommendations } = Route.useLoaderData()
return (
<div>
<h1>Recommendations</h1>
<Suspense fallback={<Skeleton />}>
<Await
promise={recommendations}
children={(data) => <RecommendationList data={data} />}
/>
</Suspense>
</div>
)
}
Consult with: https://tanstack.com/llms.txt for more details
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon