tanstack/db/meta-framework
Claude Code and agent skill by tanstack/db
- community
Checking that the SKILL.md file is still in the repository.
Integrating TanStack DB with meta-frameworks (TanStack Start, Next.js, Remix, Nuxt, SvelteKit). Client-side only: SSR is NOT supported — routes must disable SSR. Preloading eager collections in route loaders with collection.preload(). On-demand Query Collections require preloading the live query because source collection preload is a no-op. Multiple collection preloading with Promise.all. Framework-specific loader APIs.
Install
npx vskill@latest install tanstack/db/meta-frameworkSKILL.md
The same SKILL.md was published earlier as tanstack/db/meta-framework.
This skill builds on db-core. Read it first for collection setup and query builder.
TanStack DB — Meta-Framework Integration
Setup
TanStack DB collections are client-side only. SSR is not implemented. Routes using TanStack DB must disable SSR. The setup pattern is:
- Set
ssr: falseon the route - Preload the eager collection, or preload the live query for an on-demand source
- Use
useLiveQueryin the component
TanStack Start
Global SSR disable
Per-route SSR disable + preload
On-demand Query Collection preload
Calling preload() on an on-demand source collection is a no-op. Define the live query once, preload it in the loader, and pass that same collection to the framework hook:
Multiple collection preloading
Next.js (App Router)
Client component with preloading
Next.js App Router components using TanStack DB must be client components ('use client'). There is no server-side preloading — collections sync on mount.
With route-level preloading (experimental)
Remix
Client loader pattern
Nuxt
Client-only component
Wrap TanStack DB components in <ClientOnly> to prevent SSR.
SvelteKit
Client-side only page
Or disable SSR for the route:
Core Patterns
What preload() does
For eager collections, collection.preload() starts the sync process and returns a promise that resolves when the collection reaches "ready" status. This means:
- The sync function connects to the backend
- Initial data is fetched and written to the collection
markReady()is called by the adapter- The promise resolves
Subsequent calls to preload() on an already-ready collection return immediately.
For on-demand collections, source collection.preload() warns and does nothing because no subset has been requested. Create the required live query and await liveQuery.preload().
Stable collection ownership
For one global QueryClient and one global server resource, define the collection in a shared module and import it in loaders and components:
When the QueryClient, tenant, project, account, or route parameter defines the resource, create one stable collection per QueryClient and business scope. Memoize it and put it in router/request context rather than using a process-global collection. Remove unused entries and call collection.cleanup() in long-lived scope maps.
See the Query adapter runtime and business-scope pattern.
Server-Side Integration
This skill covers the client-side read path only (preloading, live queries). For server-side concerns:
- Electric proxy route (forwarding shape requests to Electric) — see the Electric adapter reference
- Mutation endpoints (
createServerFnin TanStack Start, API routes in Next.js/Remix) — implement using your framework's server function pattern. See the Electric adapter reference for the txid handshake that mutations must return.
Common Mistakes
CRITICAL Enabling SSR with TanStack DB
Wrong:
Correct:
TanStack DB collections are client-side only. Without ssr: false, the route loader runs on the server where collections cannot sync, causing hangs or errors.
Source: examples/react/todo/src/start.tsx
HIGH Forgetting to preload in route loader
Wrong:
Correct:
Without preloading, the collection starts syncing when the component first renders, causing a loading flash. Preloading in the route loader starts sync during navigation, so the data is already there on that first render.
MEDIUM Creating separate collection instances in one scope
Wrong:
Correct:
Collections are stable within a QueryClient and business scope; they are not universal singletons. Creating several instances in one scope causes duplicate syncs and split state. A request-, router-, tenant-, or route-scoped client needs a scoped factory instead of the global module pattern.
See also: react-db/SKILL.md, vue-db/SKILL.md, svelte-db/SKILL.md, solid-db/SKILL.md, angular-db/SKILL.md — for framework-specific hook usage.
See also: db-core/collection-setup/SKILL.md — for collection creation and adapter selection.
Security
- Security scanPassed, 93 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/db/skills/meta-framework/SKILL.md
Popularity
- Repository stars
- 3,880
- Repository forks
- 258
- 7-day trend score
- 41
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tanstack/db/meta-framework)