Skip to content

Commit 080b305

Browse files
simplify and fix guide by using example app instead of the tanstack cli
1 parent e46808b commit 080b305

File tree

1 file changed

+9
-76
lines changed
  • src/content/docs/workers/framework-guides/web-apps

1 file changed

+9
-76
lines changed

src/content/docs/workers/framework-guides/web-apps/tanstack.mdx

Lines changed: 9 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ In this guide, you will create a new [TanStack Start](https://tanstack.com/start
2222

2323
### Create the project
2424

25-
Start by creating a new project using the official TanStack CLI:
25+
Start by cloning the basic template from the official TanStack repository
2626

2727
<PackageManagers
28-
type="create"
29-
pkg="@tanstack/start@latest"
30-
args="my-tanstack-app"
28+
type="dlx"
29+
pkg="gitpick"
30+
args="TanStack/router/tree/main/examples/react/start-basic-cloudflare my-tanstack-app"
3131
/>
3232

3333
After setting up your project, change your directory by running the following command:
@@ -36,77 +36,9 @@ After setting up your project, change your directory by running the following co
3636
cd my-tanstack-app
3737
```
3838

39-
### Install the Cloudflare dependencies
39+
And install the project's dependencies with:
4040

41-
Inside the project's directory install the Cloudflare development dependencies:
42-
43-
<PackageManagers pkg="@cloudflare/vite-plugin wrangler" dev />
44-
45-
### Create a `wrangler.jsonc` file
46-
47-
Create a `wrangler.jsonc` file with the following:
48-
49-
```json
50-
{
51-
"$schema": "node_modules/wrangler/config-schema.json",
52-
"name": "my-tanstack-app",
53-
"compatibility_date": "2025-09-02",
54-
"compatibility_flags": ["nodejs_compat"],
55-
"main": "@tanstack/react-start/server-entry"
56-
}
57-
```
58-
59-
### Add Cloudflare scripts to the `package.json` file
60-
61-
Add the following scripts to your `package.json` file:
62-
63-
```json
64-
"deploy": "wrangler deploy",
65-
"cf-typegen": "wrangler types"
66-
```
67-
68-
- `deploy`: used to deploy your application after you have built it
69-
70-
- `cf-typegen`: used to generate Cloudflare TypeScript types for your project based on your configuration
71-
72-
Note that there are already three relevant scripts that the TanStack CLI defined for you: `dev`, `build` and `serve`, which respectively allow you to start a local Vite dev server
73-
to develop locally your application, build your application (so that it can be deployed) and start a local preview server that you can use to validate your built application
74-
before deploying it.
75-
76-
### Update the `vite.config.ts` file
77-
78-
Next you need to update update the Vite configuration file to use the Cloudflare plugin:
79-
80-
```diff lang="ts"
81-
import { defineConfig } from 'vite'
82-
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
83-
import viteReact from '@vitejs/plugin-react'
84-
import viteTsConfigPaths from 'vite-tsconfig-paths'
85-
import tailwindcss from '@tailwindcss/vite'
86-
+import { cloudflare } from '@cloudflare/vite-plugin';
87-
88-
const config = defineConfig({
89-
plugins: [
90-
tailwindcss(),
91-
tanstackStart(),
92-
viteReact(),
93-
+ cloudflare({ viteEnvironment: { name: 'ssr' } }),
94-
],
95-
+ environments: {
96-
+ ssr: {
97-
+ optimizeDeps: {
98-
+ exclude: ['@tanstack/react-devtools']
99-
+ }
100-
+ }
101-
+ }
102-
})
103-
```
104-
105-
:::note
106-
107-
The `optimizeDeps` setting here is a temporary workaround and won't be necessary with future TanStack Start releases.
108-
109-
:::
41+
<PackageManagers type="install" />
11042

11143
## 2. Develop locally
11244

@@ -130,9 +62,10 @@ If you're using CI, ensure you update your ["deploy command"](/workers/ci-cd/bui
13062

13163
:::note
13264

133-
After having built the application you can run the `serve` script to preview the build output locally before deploying.
65+
After having built the application you can run the `preview` script to preview the built output locally before deploying it.
66+
This can help you making sure that your application will work as intended once it's been deployed to the Cloudflare network:
13467

135-
<PackageManagers type="run" args="serve" />
68+
<PackageManagers type="run" args="preview" />
13669

13770
:::
13871

0 commit comments

Comments
 (0)