Cursor rules for combining Next.js App Router with TanStack Query v5 — covering the hydration pattern, Server Components vs Client Components data fetching strategy, Server Actions as mutation functions, and optimistic updates.
- QueryProvider setup with per-session
QueryClient - Server-side prefetch +
HydrationBoundaryhydration pattern queryOptionsfactory pattern with key factories- Next.js Server Actions as
mutationFnin TanStack Query mutations - Optimistic updates with rollback
- Infinite scroll with
useInfiniteQuery - When to use Server Components vs TanStack Query (decision table)
- Route Handler (API route) patterns for query targets
Created by usm4nhafeez
Contributed to awesome-cursorrules