Each supported framework comes with its own package. Each framework package re-exports everything from the core @tanstack/db package.
npm install @tanstack/react-dbTanStack DB is compatible with React v18+
npm install @tanstack/solid-dbnpm install @tanstack/svelte-dbnpm install @tanstack/vue-dbTanStack DB is compatible with Vue v3.3.0+
npm install @tanstack/angular-dbTanStack DB is compatible with Angular v16.0.0+
npm install @tanstack/dbInstall the the core @tanstack/db package to use DB without a framework.
TanStack DB also provides specialized collection packages for different data sources and storage needs:
For loading data using TanStack Query:
npm install @tanstack/query-db-collectionUse queryCollectionOptions to fetch data into collections using TanStack Query. This is perfect for REST APIs and existing TanStack Query setups.
Local storage and in-memory collections are included with the framework packages:
Both use localStorageCollectionOptions and localOnlyCollectionOptions respectively, available from your framework package (e.g., @tanstack/react-db).
Use a runtime package to save Collection rows in SQLite and load them after an app restart. For a browser app, install the OPFS wrapper and its SQLite engine:
npm install @tanstack/browser-db-sqlite-persistence @journeyapps/wa-sqliteThe SQLite Persistence guide shows the browser setup and lists the mobile, desktop, server, and Durable Object packages. It also explains how to wrap an existing sync adapter.
Use @tanstack/offline-transactions to retain pending mutations and retry them when the server is available:
npm install @tanstack/offline-transactionsThe Offline Transactions guide covers web and React Native setup. It also shows how to use the outbox with a SQLite-persisted Collection.
For real-time sync with ElectricSQL:
npm install @tanstack/electric-db-collectionUse electricCollectionOptions to sync data from Postgres databases through ElectricSQL shapes. Ideal for real-time, local-first applications.
For syncing with TrailBase backends:
npm install @tanstack/trailbase-db-collectionUse trailBaseCollectionOptions to sync records from TrailBase's Record APIs with built-in subscription support.
For offline-first sync with PowerSync:
Use powerSyncCollectionOptions to sync data via PowerSync's SQLite-based database with real-time synchronization to PostgreSQL, MongoDB, and MySQL backends. Install the collection package plus the platform-specific PowerSync SDK and SQLite adapter:
Web
npm install @tanstack/powersync-db-collection @powersync/web @journeyapps/wa-sqliteReact Native
npm install @tanstack/powersync-db-collection @powersync/react-native @powersync/op-sqlite @op-engineering/op-sqliteOr use @journeyapps/react-native-quick-sqlite as an alternative SQLite adapter.
See the PowerSync Collection documentation for setup details.
For offline-first apps and local persistence with RxDB:
npm install @tanstack/rxdb-db-collectionUse rxdbCollectionOptions to bridge an RxDB collection into TanStack DB. This gives you reactive TanStack DB collections backed by RxDB's powerful local-first database, replication, and conflict handling features.