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
Copy file name to clipboardExpand all lines: src/content/docs/workers/framework-guides/web-apps/tanstack-start.mdx
+59-2Lines changed: 59 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,11 +14,17 @@ import {
14
14
InlineBadge,
15
15
Render,
16
16
PackageManagers,
17
+
Steps,
18
+
WranglerConfig,
17
19
} from"~/components";
18
20
19
-
In this guide, you will create a new [TanStack Start](https://tanstack.com/start)application and deploy it to Cloudflare Workers.
21
+
[TanStack Start](https://tanstack.com/start)is a full-stack framework for building web applications. It comes with features like server-side rendering, streaming, server functions, bundling, and more. In this guide, you learn to deploy a TanStack Start application to Cloudflare Workers.
20
22
21
-
## 1. Set up a new project
23
+
## 1. Set up a TanStack Start project
24
+
25
+
If you have an existing TanStack Start application, skip to the [Configuring an existing TanStack Start application](#configuring-an-existing-tanstack-start-application) section.
26
+
27
+
### Creating a new TanStack Start application
22
28
23
29
Use the [`create-cloudflare`](https://www.npmjs.com/package/create-cloudflare) CLI (C3) to set up a new project. C3 will create a new project directory, initiate TanStack Start's official setup tool, and provide the option to deploy instantly.
24
30
@@ -36,6 +42,57 @@ After setting up your project, change your directory by running the following co
36
42
cd my-tanstack-start-app
37
43
```
38
44
45
+
### Configuring an existing TanStack Start application
46
+
47
+
If you have an existing TanStack Start application, you can configure it to run on Cloudflare Workers by following these steps:
48
+
49
+
<Steps>
50
+
1. Add the `wrangler.jsonc` configuration file to the root of your project with the following content:
51
+
<WranglerConfig>
52
+
```toml
53
+
name = "<YOUR_PROJECT_NAME>"
54
+
compatibility_date = "2025-09-02"
55
+
compatibility_flags = ["nodejs_compat"]
56
+
main = "@tanstack/react-start/server-entry"
57
+
[observability]
58
+
enabled = true
59
+
```
60
+
</WranglerConfig>
61
+
62
+
2. Install `wrangler` as a development dependency:
63
+
64
+
<PackageManagersdevpkg="wrangler@latest" />
65
+
66
+
3. Install the `@cloudflare/vite-plugin` package as a dependency:
5. Update the `scripts` section of your `package.json` file to include the following commands:
84
+
85
+
```jsonc title="package.json"
86
+
"scripts": {
87
+
...
88
+
"deploy":"npm run build && wrangler deploy",
89
+
"preview":"npm run build && vite preview",
90
+
"cf-typegen":"wrangler types"
91
+
}
92
+
```
93
+
94
+
</Steps>
95
+
39
96
## 2. Develop locally
40
97
41
98
After you have created your project, run the following command in the project directory to start a local development server. This will allow you to preview your project locally during development.
0 commit comments