trpc-tanstack-nextjs
28
总安装量
9
周安装量
#12922
全站排名
安装命令
npx skills add https://github.com/diegojohnsonl/trpc-tanstack-nextjs --skill trpc-tanstack-nextjs
Agent 安装分布
codex
9
opencode
9
github-copilot
8
gemini-cli
7
kimi-cli
5
Skill 文档
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 modulesrouters– Creating routers, procedures, middlewareclient-usage– Queries, mutations, useUtils in client componentsserver-usage– Prefetching, hydration, getCaller in server components
Optional Integrations
better-auth-integration– Add session/user to tRPC context with Better Authoptimistic-updates– Update UI before server confirmsinfinite-queries– Cursor-based paginationsubscriptions– 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
- Cookies not sent – Add
credentials: "include"to httpBatchLink fetch - Hydration mismatch – Ensure superjson transformer on both client and server
- staleTime: 0 – Causes refetch on every mount; use 30s+ for most cases
- Missing HydrateClient – Prefetched data won’t transfer to client
- cache() not used – getCaller/getQueryClient must be wrapped in React cache()