| 1 | # Cloudflare Website: React Router |
| 2 | |
| 3 | Deploys a [React Router](https://reactrouter.com) v7 app — in React |
| 4 | Server Components mode — to Cloudflare Workers with |
| 5 | `Cloudflare.Website.Vite`. No Wrangler configuration and no manual |
| 6 | entrypoint: the RSC build emits two server environments (`rsc` and |
| 7 | `ssr`), and `viteEnvironments` in `alchemy.run.ts` tells Alchemy how |
| 8 | they assemble into one Worker. |
| 9 | |
| 10 | - `app/routes/home.tsx` is a server component rendered in the Worker on |
| 11 | every request; it reads the `GREETING` value declared in |
| 12 | `alchemy.run.ts` from `process.env` (populated by date-default Node.js |
| 13 | compatibility flag). |
| 14 | - `app/components/Card.tsx` is a React component styled with Tailwind |
| 15 | utilities (wired through `@tailwindcss/vite` in `vite.config.ts`). |
| 16 | - `react-router-vite/` holds one entry module per Vite environment — |
| 17 | the browser bundle, the SSR renderer, and the Worker handler. |
| 18 | - Everything under `public/` deploys as static assets. |
| 19 | |
| 20 | ## Deploy |
| 21 | |
| 22 | ```sh |
| 23 | bun run deploy |
| 24 | ``` |
| 25 | |
| 26 | Unchanged sources skip the Vite build entirely on subsequent deploys — |
| 27 | the input files are content-hashed (scoped by `memo.include`). |
| 28 | |
| 29 | ## Destroy |
| 30 | |
| 31 | ```sh |
| 32 | bun run destroy |
| 33 | ``` |