11# Fullstack Monorepo Template
22
3- A fullstack monorepo template using pnpm workspaces with a Cloudflare Worker backend and TanStack Start frontend .
3+ A fullstack monorepo template using pnpm workspaces with Cloudflare Workers for both backend and frontend ( TanStack Start with SSR) .
44
55## Project Structure
66
77```
88.
99├── packages/
10- │ ├── worker/ # Cloudflare Worker API (Hono + RPC)
11- │ └── web/ # TanStack Start web app
10+ │ ├── worker/ # Backend Cloudflare Worker (Hono + RPC)
11+ │ └── web/ # Frontend Cloudflare Worker ( TanStack Start with SSR)
1212├── package.json # Root package.json with workspace scripts
1313└── pnpm-workspace.yaml # pnpm workspace configuration
1414```
1515
1616## Features
1717
1818- ** Worker RPC** : Service bindings enable type-safe RPC calls from web to worker
19- - ** Hono API** : REST API endpoints in the worker
20- - ** TanStack Start** : Modern React framework with SSR
19+ - ** Hono API** : REST API endpoints in the backend worker
20+ - ** TanStack Start** : Modern React framework with SSR deployed on Cloudflare Workers
2121- ** Type Safety** : Full TypeScript support across packages
2222- ** Monorepo** : Shared dependencies and scripts via pnpm workspaces
23+ - ** Deploy to Workers** : Both packages deploy as Cloudflare Workers for optimal performance
2324
2425## Prerequisites
2526
@@ -81,7 +82,7 @@ The worker will run on http://localhost:8787 and the web app on http://localhost
8182
8283- ` pnpm --filter @fullstack-monorepo-template/web dev ` - Start in development mode
8384- ` pnpm --filter @fullstack-monorepo-template/web build ` - Build for production
84- - ` pnpm --filter @fullstack-monorepo-template/web deploy ` - Deploy to Cloudflare Pages
85+ - ` pnpm --filter @fullstack-monorepo-template/web deploy ` - Deploy to Cloudflare Workers
8586
8687## Deployment
8788
@@ -104,18 +105,21 @@ pnpm deploy:worker
104105
105106### Web App
106107
107- 1 . Build and deploy to Cloudflare Pages:
108+ The web app is deployed as a Cloudflare Worker (not Pages), which enables server-side rendering and RPC communication with the backend worker.
109+
110+ 1 . Login to Cloudflare (if not already done):
108111
109112``` bash
110- pnpm deploy:web
113+ cd packages/web
114+ pnpm wrangler login
111115```
112116
113- Or deploy to any static hosting service:
117+ 2 . Update ` wrangler.jsonc ` with your account details
118+
119+ 3 . Deploy:
114120
115121``` bash
116- cd packages/web
117- pnpm build
118- # Upload dist/ directory to your hosting service
122+ pnpm deploy:web
119123```
120124
121125## Using Worker RPC
@@ -177,15 +181,15 @@ See `packages/web/src/routes/rpc/README.md` for detailed documentation on the RP
177181
178182### Web App
179183
180- - ` packages/web/wrangler.jsonc ` - Cloudflare Pages configuration (includes service binding)
184+ - ` packages/web/wrangler.jsonc ` - Cloudflare Workers configuration (includes service binding)
181185- ` packages/web/vite.config.ts ` - Vite configuration
182186- ` packages/web/src/routes/ ` - TanStack Start routes
183187
184188## Tech Stack
185189
186190- ** Monorepo** : pnpm workspaces
187- - ** Worker** : Cloudflare Workers, Hono, WorkerEntrypoint (RPC), TypeScript
188- - ** Web ** : TanStack Start, React, TypeScript
191+ - ** Backend Worker** : Cloudflare Workers, Hono, WorkerEntrypoint (RPC), TypeScript
192+ - ** Frontend Worker ** : Cloudflare Workers, TanStack Start (SSR) , React, TypeScript
189193- ** Testing** : Vitest
190194- ** Linting** : ESLint, Prettier
191195
0 commit comments