Open History to see the last commit
1# Offline Transactions Example
2
3A todo app demonstrating `@tanstack/offline-transactions` with three different browser storage backends:
4
5- **IndexedDB** — persistent structured storage via `IndexedDBAdapter`
6- **localStorage** — simple key-value fallback via `LocalStorageAdapter`
7- **wa-sqlite OPFS** — full SQLite database in the browser via `@tanstack/browser-db-sqlite-persistence`
8
9The app uses TanStack Start in SPA mode with an in-memory server-side todo store. The server simulates network delays and random failures to demonstrate offline resilience.
10
11## How to run
12
13From the root of the repository:
14
15```sh
16pnpm install
17pnpm build
18```
19
20Then from this directory:
21
22```sh
23pnpm dev
24```
25
26The app runs at http://localhost:3000.
27
28## What it demonstrates
29
30- **Outbox pattern** — mutations are persisted locally before syncing to the server
31- **Automatic retry** — failed operations retry with exponential backoff when connectivity returns
32- **Multi-tab coordination** — leader election ensures only one tab manages offline storage
33- **Optimistic updates** — UI updates immediately while mutations sync in the background
34- **Collection-level persistence** (wa-sqlite route) — data stored in a real SQLite database in the browser via OPFS, surviving page reloads without server sync