Open History to see the last commit
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## Vanilla JS
37
38```sh
39npm install @tanstack/db
40```
41
42Install the the core `@tanstack/db` package to use DB without a framework.
43
44## Collection Packages
45
46TanStack DB also provides specialized collection packages for different data sources and storage needs:
47
48### Query Collection
49
50For loading data using TanStack Query:
51
52```sh
53npm install @tanstack/query-db-collection
54```
55
56Use `queryCollectionOptions` to fetch data into collections using TanStack Query. This is perfect for REST APIs and existing TanStack Query setups.
57
58### Local Collections
59
60Local storage and in-memory collections are included with the framework packages:
61
62- **LocalStorageCollection** - For persistent local data that syncs across browser tabs
63- **LocalOnlyCollection** - For temporary in-memory data and UI state
64
65Both use `localStorageCollectionOptions` and `localOnlyCollectionOptions` respectively, available from your framework package (e.g., `@tanstack/react-db`).
66
67### Sync Engines
68
69#### Electric Collection
70
71For real-time sync with [ElectricSQL](https://electric-sql.com):
72
73```sh
74npm install @tanstack/electric-db-collection
75```
76
77Use `electricCollectionOptions` to sync data from Postgres databases through ElectricSQL shapes. Ideal for real-time, local-first applications.
78
79#### TrailBase Collection
80
81For syncing with [TrailBase](https://trailbase.io) backends:
82
83```sh
84npm install @tanstack/trailbase-db-collection
85```
86
87Use `trailBaseCollectionOptions` to sync records from TrailBase's Record APIs with built-in subscription support.