tanstack-db

Create reactive client-side data stores with live queries and optimistic mutations.

Updated Jul 2, 2025
One-click install
npx skills add https://github.com/janpeterd/dotfiles --skill tanstack-db-janpeterd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-db
Source: https://github.com/janpeterd/dotfiles/tree/main/dot_agents/skills/tanstack-db
Command: npx skills add https://github.com/janpeterd/dotfiles --skill tanstack-db-janpeterd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack DB eliminates the complexity of keeping client state, server data, and optimistic UI updates synchronized while enabling fast, reactive query results.

Core Features & Use Cases

  • Collections with multiple sync backends: Normalize data and connect to data sources like TanStack Query via query collections.
  • Live queries: Build SQL-like queries that automatically re-run and update UI on underlying data changes, including joins across collections.
  • Optimistic mutations with rollback: Apply inserts/updates/deletes instantly in the UI while synchronizing changes in the background.

Quick Start

Create a query collection for your API data and then use a live query to filter, sort, limit, and reactively render results from that collection.

Frequently Asked Questions about tanstack-db

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build live queries that automatically update the UI when client-side data changes?

Live queries use TanStack DB’s createCollection and useLiveQuery patterns to automatically re-run and update UI results when underlying collection data changes, including across joined views.

What is the best way to implement optimistic mutations that stay consistent with API data?

Optimistic mutations with rollback apply inserts, updates, and deletes instantly in the UI while using onInsert, onUpdate, and onDelete handlers to synchronize changes with the API in the background.

How do I normalize client-side data and connect it to TanStack Query?

You normalize data by creating query collections using queryCollectionOptions integration, which connects TanStack DB collections to sync backends like TanStack Query for reactive client-first storage.

Can I perform SQL-like joins across multiple client-side collections?

Yes, TanStack DB live queries support building SQL-like queries that re-run automatically, enabling efficient joined views across multiple normalized collections on the client.

When do I need a reactive client store with differential dataflow?

You need a reactive client store with differential dataflow when building applications requiring query-driven syncing, efficient updates over large datasets, and joined views across multiple collections.

Does TanStack DB require specific mutation handlers for server synchronization?

Yes, applying optimistic mutations that stay consistent with API data requires implementing mutation handlers like onInsert, onUpdate, and onDelete for background server synchronization.