You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get up-and-running with Electric and TanStack DB. Install, develop and deploy a super-fast, reactive web app, based on real-time sync of your Postgres data.
5
-
outline: 2
5
+
outline: [2,3]
6
6
---
7
7
8
8
<pclass="intro-zap-container">
@@ -14,7 +14,7 @@ outline: 2
14
14
15
15
# Quickstart
16
16
17
-
Let's make a super-fast, reactive web app <spanclass="no-wrap-xs">using [Electric](/product/electric) with [TanStack DB](#product/tanstack-db)</span>.
17
+
Let's make a super-fast, reactive web app using <spanclass="no-wrap-xs">[Electric with TanStack DB](/blog/2025/07/29/local-first-sync-with-tanstack-db)</span>.
18
18
19
19
<divstyle="max-width: 632px">
20
20
@@ -23,153 +23,66 @@ Let's make a super-fast, reactive web app <span class="no-wrap-xs">using [Electr
23
23
24
24
</div>
25
25
26
+
## Get started
27
+
26
28
:::tabs
27
29
== Electric Cloud (default)
28
30
29
31
Run the starter script:
30
32
31
33
```shell
32
-
pnpx @electric-sql/start my-electric-app
34
+
npx @electric-sql/start my-electric-app
33
35
```
34
36
35
-
This generates a [TanStack Start](https://tanstack.com/start/latest/docs/framework/react/overview) app in `my-electric-app` and runs a [Postgres database](https://electric-sql.com/docs/guides/deployment#_1-running-postgres) and [Electric sync service](https://electric-sql.com/docs/guides/deployment#_2-running-electric) for you in the [Electric Cloud](/product/cloud).
36
-
37
-
You can then run the app locally using:
37
+
Start the dev server:
38
38
39
39
```shell
40
40
pnpm dev
41
41
```
42
42
43
-
Open in your web browser at [localhost:5173](http://localhost:5173).
44
-
45
-
### Postgres sync
43
+
Open [https://localhost:5173](https://localhost:5173).
46
44
47
-
Lets change some data in Postgres and see the app instantly react.
45
+
## See the real-time sync
48
46
49
-
Arrange your windows so you can see the app running in your web browser and your terminal at the same time. Open the "Default" project page in the browser.
50
-
51
-
Then in your terminal, connect to Postgres using `psql`:
47
+
In another terminal, connect to Postgres using `psql`:
52
48
53
49
```shell
54
50
pnpm psql
55
51
```
56
52
57
-
This will open the psql shell:
58
-
59
-
```
60
-
psql (17.4, server 17.6)
61
-
Type "help" for help.
62
-
63
-
electric=#
64
-
```
65
-
66
53
Update the project name:
67
54
68
55
```sql
69
56
UPDATE projects SET name ='Baz bam!';
70
57
```
71
58
72
-
Keep changing the project name. The app updates instantly in real-time — for all users.
73
-
74
-
### Develop the app
75
-
76
-
The starter app is a fully-fledged [TanStack Start](https://tanstack.com/start) application with routing and auth, ready for you to build out into a real app.
77
-
78
-
#### Changing the code
79
-
80
-
Let's change the code and see what happens. Open a project page in your browser and add a few todos. Note that new todo items are sorted last, at the bottom of the list.
81
-
82
-
Open up the code for the project page in `src/routes/_authenticated/project/$projectId.tsx`. You can see the live query for the todo list towards the top of the `ProjectPage` component:
This queries the local TanStack DB `todoCollection` for todos that belong to the current project and sorts them by `created_at`. The default sort order is `asc`. Let's update the code to make that explicit.
Now, with the browser page open and visible, toggle the direction value between `asc` and `desc`:
115
-
116
-
```tsx
117
-
const direction ='desc'
118
-
```
119
-
120
-
You'll see the todo list re-ordering live in the page.
59
+
The app updates instantly in real-time — across all users and devices.
121
60
122
-
See the blog post introducing [developing with Electric and TanStack DB](/blog/2025/07/29/local-first-sync-with-tanstack-db) and the [Interactive Guide to TanStack DB](https://frontendatscale.com/blog/tanstack-db/) for a high level intro on the stack.
61
+
## Develop your app
123
62
124
-
Dive into the [Tutorial](tutorial.md) for a more in-depth walkthrough of how to develop out a production-quality app with Electric and TanStack DB.
63
+
The starter is a fully-fledged [TanStack Start](https://tanstack.com/start/latest/docs/framework/react/overview)app with routing and auth.
125
64
126
-
#### Using coding agents
65
+
You can edit the code manually. Or it has an `AGENTS.md` file you can load directly into your AI code editor:
127
66
128
-
The quickstart template ships with an `AGENTS.md` file. Load this into your LLM and have it make changes for you.
129
-
130
-
For example:
131
-
132
-
```
133
-
Read AGENTS.md. Sort the todo list on the project page alphabetically.
67
+
```sh
68
+
claude "Read Agents.md. Sort the project page todo list alphabetically."
134
69
```
135
70
136
-
### Claim the resources
137
-
138
-
The Postgres database and Electric sync service provisioned when you generated the app are temporary. They'll be scaled down automatically and then deleted in a few days time.
139
-
140
-
To continue using them, you can claim them. This allows you to create or sign-in to accounts with Electric Cloud (for the sync service) and Neon (for the database hosting) and move the resources into your accounts so you can manage and control them.
71
+
## Deploy your app
141
72
142
-
To claim the resources run:
73
+
Claim the [Electric Cloud](/product/cloud) resources:
143
74
144
75
```shell
145
76
pnpm claim
146
77
```
147
78
148
-
Follow the instructions in the your web browser.
149
-
150
-
### Deploy and share the app
151
-
152
-
To deploy your local app to [Netlify](https://tanstack.com/start/latest/docs/framework/react/hosting#what-is-netlify), run:
79
+
Deploy the app to [Netlify](https://tanstack.com/start/latest/docs/framework/react/hosting#what-is-netlify):
153
80
154
81
```sh
155
82
pnpm deploy
156
83
```
157
84
158
-
TanStack Start is designed to work with any hosting provider. See the [Hosting docs](https://tanstack.com/start/latest/docs/framework/react/hosting) for instructions.
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
so if you already have a hosting provider in mind, you can deploy your application there using the full-stack APIs provided by TanStack Start.
167
-
168
-
169
-
170
-
TanStack Start is a full-stack framework powered by TanStack Router. It provides a full-document SSR, streaming, server functions, bundling, and more. Thanks to Vite, it's ready to develop and deploy to any hosting provider or runtime you want!
171
-
172
-
-[ ] deploy the app
85
+
Congratulations! You've shipped a super-fast, reactive web app!
173
86
174
87
== Docker Compose
175
88
@@ -180,3 +93,9 @@ TanStack Start is a full-stack framework powered by TanStack Router. It provides
180
93
... manual install flow ...
181
94
182
95
:::
96
+
97
+
## Next steps
98
+
99
+
<!-- - follow the [Tutorial](/docs/tutorial) to evolve your starter into a production-quality app. -->
100
+
- learn more about [Local-first sync with Electric and TanStack DB](/blog/2025/07/29/local-first-sync-with-tanstack-db)
101
+
- see the [Interactive guide to TanStack DB](https://frontendatscale.com/blog/tanstack-db).
Copy file name to clipboardExpand all lines: website/docs/stacks.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,7 +267,7 @@ For example, sync into [LiveStore](https://docs.livestore.dev/reference/syncing/
267
267
268
268
[Tanstack DB](https://tanstack.com/db) is a reactive client store for [building super fast apps on sync](https://tanstack.com/blog/tanstack-db-0.1-the-embedded-client-database-for-tanstack-query).
269
269
270
-
Paired with [Electric](/) and [TanStack Start](https://tanstack.com/start), it gives you an end-to-end sync stack that's type-safe, declarative, incrementally adoptable and insanely fast.
270
+
[Paired with Electric](/blog/2025/07/29/local-first-sync-with-tanstack-db) and [TanStack Start](https://tanstack.com/start), it gives you an end-to-end sync stack that's type-safe, declarative, incrementally adoptable and insanely fast.
0 commit comments