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 v18+
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### SQLite Persistence
76
77Use 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:
78
79```sh
80npm install @tanstack/browser-db-sqlite-persistence @journeyapps/wa-sqlite
81```
82
83The [SQLite Persistence guide](./guides/sqlite-persistence.md) shows the browser setup and lists the mobile, desktop, server, and Durable Object packages. It also explains how to wrap an existing sync adapter.
84
85### Offline Transactions
86
87Use `@tanstack/offline-transactions` to retain pending mutations and retry them when the server is available:
88
89```sh
90npm install @tanstack/offline-transactions
91```
92
93The [Offline Transactions guide](./guides/offline-transactions.md) covers web and React Native setup. It also shows how to use the outbox with a SQLite-persisted Collection.
94
95### Sync Engines
96
97#### Electric Collection
98
99For real-time sync with [ElectricSQL](https://electric-sql.com):
100
101```sh
102npm install @tanstack/electric-db-collection
103```
104
105Use `electricCollectionOptions` to sync data from Postgres databases through ElectricSQL shapes. Ideal for real-time, local-first applications.
106
107#### TrailBase Collection
108
109For syncing with [TrailBase](https://trailbase.io) backends:
110
111```sh
112npm install @tanstack/trailbase-db-collection
113```
114
115Use `trailBaseCollectionOptions` to sync records from TrailBase's Record APIs with built-in subscription support.
116
117#### PowerSync Collection
118
119For offline-first sync with [PowerSync](https://powersync.com):
120
121Use `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:
122
123**Web**
124
125```sh
126npm install @tanstack/powersync-db-collection @powersync/web @journeyapps/wa-sqlite
127```
128
129**React Native**
130
131```sh
132npm install @tanstack/powersync-db-collection @powersync/react-native @powersync/op-sqlite @op-engineering/op-sqlite
133```
134
135Or use `@journeyapps/react-native-quick-sqlite` as an alternative SQLite adapter.
136
137See the [PowerSync Collection documentation](./collections/powersync-collection.md) for setup details.
138
139### RxDB Collection
140
141For offline-first apps and local persistence with [RxDB](https://rxdb.info):
142
143```sh
144npm install @tanstack/rxdb-db-collection
145```
146
147Use `rxdbCollectionOptions` to bridge an [RxDB collection](https://rxdb.info/rx-collection.html) into TanStack DB.
148This gives you reactive TanStack DB collections backed by RxDB's powerful local-first database, replication, and conflict handling features.