Open History to see the last commit
1# TanStack Start - Cloudflare Example
2β
3A TanStack Start example demonstrating deployment to Cloudflare Workers.
4β
5- [TanStack Router Docs](https://tanstack.com/router)
6- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)
7β
8## Start a new project based on this example
9β
10To start a new project based on this example, run:
11β
12```sh
13npx gitpick TanStack/router/tree/main/examples/react/start-basic-cloudflare start-basic-cloudflare
14```
15β
16## Getting Started
17β
18From your terminal:
19β
20```sh
21pnpm install
22pnpm dev
23```
24β
25This starts your app in development mode, rebuilding assets on file changes.
26β
27## Build
28β
29To build the app for production:
30β
31```sh
32pnpm build
33```
34β
35## Preview
36β
37To preview the production build locally:
38β
39```sh
40pnpm preview
41```
42β
43## Deploy to Cloudflare
44β
45To deploy your app to Cloudflare Workers:
46β
47```sh
48pnpm run deploy
49```
50β
51## Accessing Cloudflare Bindings
52β
53You can access Cloudflare bindings in server functions by using importable `env`:
54β
55```ts
56import { env } from 'cloudflare:workers'
57```
58β
59See `src/routes/index.tsx` for an example.
60β
61## Cloudflare Configuration
62β
63This example includes:
64β
65- Wrangler configuration for Cloudflare Workers
66- Type generation for Cloudflare bindings
67- Server-side rendering on the edge
68- Access to Cloudflare platform features (KV, D1, R2, etc.)