https://github.com/edmundhung/cloudflare-react-router-rsc
React Router RSC on Cloudflare
https://github.com/edmundhung/cloudflare-react-router-rsc
cloudflare-workers react-router rsc
Last synced: 5 months ago
JSON representation
React Router RSC on Cloudflare
- Host: GitHub
- URL: https://github.com/edmundhung/cloudflare-react-router-rsc
- Owner: edmundhung
- Created: 2026-01-29T15:54:37.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-29T16:07:02.000Z (5 months ago)
- Last Synced: 2026-02-03T23:52:39.238Z (5 months ago)
- Topics: cloudflare-workers, react-router, rsc
- Language: TypeScript
- Homepage: https://cloudflare-react-router-rsc.edmundhung.workers.dev/
- Size: 97.7 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Router RSC on Cloudflare Workers
This template runs React Router's experimental RSC Framework Mode on Cloudflare Workers.
> **Warning**: RSC Framework Mode is experimental.
## Quick Start
```bash
pnpm install
pnpm dev
```
## Cloudflare Setup Guide
Starting from the [RSC Framework Mode template](https://github.com/remix-run/react-router-templates/tree/main/unstable_rsc-framework-mode):
### 1. Install dependencies
```bash
pnpm add -D @cloudflare/vite-plugin wrangler
pnpm remove @react-router/serve @remix-run/node-fetch-server
```
### 2. Add Cloudflare plugin to vite.config.ts
```ts
import { cloudflare } from "@cloudflare/vite-plugin";
export default defineConfig({
plugins: [
cloudflare({
viteEnvironment: {
name: "rsc",
childEnvironments: ["ssr"],
},
}),
// ... keep existing plugins
],
});
```
### 3. Create wrangler.json
```json
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "my-app",
"main": "@react-router/dev/config/default-rsc-entries/entry.rsc",
"compatibility_date": "2026-01-29",
"compatibility_flags": ["nodejs_compat"]
}
```
- `main` points to React Router's default RSC entry (no custom worker needed)
- `nodejs_compat` is required for React's usage on Async Local Storage APIs
### 4. Other files
The rest follows the [standard Cloudflare React Router setup](https://developers.cloudflare.com/workers/frameworks/framework-guides/react-router/):
- [package.json](./package.json) - Add `preview`, `deploy`, `cf-typegen` scripts
- [tsconfig.json](./tsconfig.json), [tsconfig.node.json](./tsconfig.node.json), [tsconfig.cloudflare.json](./tsconfig.cloudflare.json)
- [.gitignore](./.gitignore) - Add `/.wrangler/`
## Resources
- [React Router RSC Docs](https://reactrouter.com/how-to/react-server-components)
- [Cloudflare Vite Plugin](https://developers.cloudflare.com/workers/vite-plugin/)