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

README.md

55 lines1.7 KB

1# TanStack DB Start SSR Demo
2​
3This example is a minimal TanStack Start app that demonstrates TanStack DB SSR
4with collection-row hydration.
5​
6It verifies five things:
7​
8- server HTML contains rows loaded through a request-scoped `DbClient`
9- the browser hydrates those rows into a client `DbClient`
10- fresh adapter sync replaces a stale hydrated row with the same key
11- an incremental collection chunk updates an existing live query
12- critical collection rows hydrate while a query discovered later in the same
13 render streams through a Suspense boundary
14​
15Live demo: https://tanstack-db-ssr-demo.netlify.app/ssr-db
16​
17## Run Locally
18​
19```sh
20pnpm --filter @tanstack/db build
21pnpm --filter @tanstack/react-db build
22pnpm --filter @tanstack/db-example-react-start-ssr-e2e dev
23```
24​
25Open `/ssr-db` for holistic and incremental hydration, or `/ssr-db-stream` for
26render-time Suspense streaming.
27​
28## Run E2E
29​
30```sh
31pnpm --filter @tanstack/db-example-react-start-ssr-e2e test:e2e
32```
33​
34The Playwright tests cover raw SSR HTML, browser hydration, fresh-sync
35reconciliation, incremental collection hydration, and critical hydration plus a
36render-time query in the same request. The streaming route shows its Suspense
37fallback before the streamed server rows arrive.
38​
39## Deploy Demo
40​
41The demo requires an SSR-capable host for TanStack Start.
42​
43Netlify deployment is configured through `netlify.toml` and
44`netlify/functions/server.mjs`. Deploy with:
45​
46```sh
47cd examples/react/start-ssr-e2e
48netlify deploy --prod --site-name tanstack-db-ssr-demo --team tanstack
49```
50​
51After deployment, verify the live URL with:
52​
53```sh
54PLAYWRIGHT_BASE_URL=https://your-demo-url pnpm --filter @tanstack/db-example-react-start-ssr-e2e test:e2e:hosted
55```