trpc-tanstack-nextjs

Set up tRPC with TanStack Query in Next.js App Router projects. Use when: (1) Setting up tRPC from scratch in a Next.js project, (2) Adding new routers or procedures, (3) Integrating authentication with tRPC context, (4) Using tRPC with React Server Components, (5) Configuring prefetching and hydration patterns.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "trpc-tanstack-nextjs" with this command: npx skills add diegojohnsonl/trpc-tanstack-nextjs/diegojohnsonl-trpc-tanstack-nextjs-trpc-tanstack-nextjs

tRPC + TanStack Query + Next.js App Router

End-to-end typesafe APIs for Next.js using tRPC v11 with @trpc/tanstack-react-query adapter.

Core Setup

  • setup - Full setup from scratch with all modules
  • routers - Creating routers, procedures, middleware
  • client-usage - Queries, mutations, useUtils in client components
  • server-usage - Prefetching, hydration, getCaller in server components

Optional Integrations

  • better-auth-integration - Add session/user to tRPC context with Better Auth
  • optimistic-updates - Update UI before server confirms
  • infinite-queries - Cursor-based pagination
  • subscriptions - WebSocket real-time updates

How to Use

Read individual reference files for detailed explanations and code examples:

references/setup.md
references/routers.md
references/client-usage.md

Each reference file contains:

  • Code examples with imports
  • Usage patterns
  • Common variations

Common Gotchas

  1. Cookies not sent - Add credentials: "include" to httpBatchLink fetch
  2. Hydration mismatch - Ensure superjson transformer on both client and server
  3. staleTime: 0 - Causes refetch on every mount; use 30s+ for most cases
  4. Missing HydrateClient - Prefetched data won't transfer to client
  5. cache() not used - getCaller/getQueryClient must be wrapped in React cache()

Resources

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

image-gen

Generate AI images from text prompts. Triggers on: "生成图片", "画一张", "AI图", "generate image", "配图", "create picture", "draw", "visualize", "generate an image".

Archived SourceRecently Updated
General

explainer

Create explainer videos with narration and AI-generated visuals. Triggers on: "解说视频", "explainer video", "explain this as a video", "tutorial video", "introduce X (video)", "解释一下XX(视频形式)".

Archived SourceRecently Updated
General

asr

Transcribe audio files to text using local speech recognition. Triggers on: "转录", "transcribe", "语音转文字", "ASR", "识别音频", "把这段音频转成文字".

Archived SourceRecently Updated