Skip to content

Commit 4d40d95

Browse files
examples: Add start-basic-cloudflare example (#5254)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent e55b436 commit 4d40d95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+10438
-34
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.DS_Store
3+
.cache
4+
.env
5+
dist
6+
.wrangler
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/public
2+
pnpm-lock.yaml
3+
routeTree.gen.ts
4+
worker-configuration.d.ts
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files.watcherExclude": {
3+
"**/routeTree.gen.ts": true
4+
},
5+
"search.exclude": {
6+
"**/routeTree.gen.ts": true
7+
},
8+
"files.readonlyInclude": {
9+
"**/routeTree.gen.ts": true
10+
}
11+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Start Basic Cloudflare
2+
3+
## Getting Started
4+
5+
### Install the dependencies
6+
7+
```bash
8+
pnpm i
9+
```
10+
11+
### Start the development server
12+
13+
```bash
14+
pnpm dev
15+
```
16+
17+
### Build for Production
18+
19+
```bash
20+
pnpm build
21+
```
22+
23+
### Preview the production build
24+
25+
```bash
26+
pnpm preview
27+
```
28+
29+
### Deploy to Cloudflare
30+
31+
```sh
32+
pnpm run deploy
33+
```
34+
35+
## Accessing bindings
36+
37+
You can access Cloudflare bindings in server functions by using importable `env`:
38+
39+
```ts
40+
import { env } from 'cloudflare:workers'
41+
```
42+
43+
See `src/routes/index.tsx` for an example.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "tanstack-start-example-basic-cloudflare",
3+
"private": true,
4+
"sideEffects": false,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite dev",
8+
"build": "vite build && tsc --noEmit",
9+
"preview": "vite preview",
10+
"deploy": "wrangler deploy",
11+
"cf-typegen": "wrangler types",
12+
"postinstall": "npm run cf-typegen"
13+
},
14+
"dependencies": {
15+
"@tanstack/react-router": "^1.132.7",
16+
"@tanstack/react-router-devtools": "^1.132.7",
17+
"@tanstack/react-start": "^1.132.9",
18+
"react": "^19.0.0",
19+
"react-dom": "^19.0.0"
20+
},
21+
"devDependencies": {
22+
"@cloudflare/vite-plugin": "^1.13.7",
23+
"@types/node": "^22.5.4",
24+
"@types/react": "^19.0.8",
25+
"@types/react-dom": "^19.0.3",
26+
"@vitejs/plugin-react": "^4.6.0",
27+
"autoprefixer": "^10.4.20",
28+
"postcss": "^8.5.1",
29+
"tailwindcss": "^3.4.17",
30+
"typescript": "^5.7.2",
31+
"vite": "^7.1.1",
32+
"vite-tsconfig-paths": "^5.1.4",
33+
"wrangler": "^4.40.2"
34+
}
35+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}
29.3 KB
Loading
107 KB
Loading
26.6 KB
Loading
832 Bytes
Loading

0 commit comments

Comments
 (0)