Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

installation.md

106 lines2.4 KB

1---
2title: Installation
3id: installation
4---
5​
6Each supported framework comes with its own package. Each framework package re-exports everything from the core `@tanstack/db` package.
7​
8## React
9​
10```sh
11npm install @tanstack/react-db
12```
13​
14TanStack DB is compatible with React v16.8+
15​
16## Solid
17​
18```sh
19npm install @tanstack/solid-db
20```
21​
22## Svelte
23​
24```sh
25npm install @tanstack/svelte-db
26```
27​
28## Vue
29​
30```sh
31npm install @tanstack/vue-db
32```
33​
34TanStack DB is compatible with Vue v3.3.0+
35​
36## Angular
37​
38```sh
39npm install @tanstack/angular-db
40```
41​
42TanStack DB is compatible with Angular v16.0.0+
43​
44## Vanilla JS
45​
46```sh
47npm install @tanstack/db
48```
49​
50Install the the core `@tanstack/db` package to use DB without a framework.
51​
52## Collection Packages
53​
54TanStack DB also provides specialized collection packages for different data sources and storage needs:
55​
56### Query Collection
57​
58For loading data using TanStack Query:
59​
60```sh
61npm install @tanstack/query-db-collection
62```
63​
64Use `queryCollectionOptions` to fetch data into collections using TanStack Query. This is perfect for REST APIs and existing TanStack Query setups.
65​
66### Local Collections
67​
68Local storage and in-memory collections are included with the framework packages:
69​
70- **LocalStorageCollection** - For persistent local data that syncs across browser tabs
71- **LocalOnlyCollection** - For temporary in-memory data and UI state
72​
73Both use `localStorageCollectionOptions` and `localOnlyCollectionOptions` respectively, available from your framework package (e.g., `@tanstack/react-db`).
74​
75### Sync Engines
76​
77#### Electric Collection
78​
79For real-time sync with [ElectricSQL](https://electric-sql.com):
80​
81```sh
82npm install @tanstack/electric-db-collection
83```
84​
85Use `electricCollectionOptions` to sync data from Postgres databases through ElectricSQL shapes. Ideal for real-time, local-first applications.
86​
87#### TrailBase Collection
88​
89For syncing with [TrailBase](https://trailbase.io) backends:
90​
91```sh
92npm install @tanstack/trailbase-db-collection
93```
94​
95Use `trailBaseCollectionOptions` to sync records from TrailBase's Record APIs with built-in subscription support.
96​
97### RxDB Collection
98​
99For offline-first apps and local persistence with [RxDB](https://rxdb.info):
100​
101```sh
102npm install @tanstack/rxdb-db-collection
103```
104​
105Use `rxdbCollectionOptions` to bridge an [RxDB collection](https://rxdb.info/rx-collection.html) into TanStack DB.
106This gives you reactive TanStack DB collections backed by RxDB's powerful local-first database, replication, and conflict handling features.