1---
2title: React Router
3description: Package React Router framework-mode SSR and browser assets for Neon Functions.
4sidebar:
5 order: 6
6---
7
8`Neon.Website.ReactRouter` builds a framework-mode React Router app and wraps its
9server handler in a Node 24 Fetch entry. Server and browser output ship together
10in a Neon Function ZIP, not a container or an S3 hosting stack. For a client-only
11React Router SPA, use [Vite](/neon/frontend/vite).
12
13## Prepare the app
14
15Use a framework-mode app or the
16[runnable React Router example](https://github.com/alchemy-run/alchemy/tree/main/examples/neon-website-react-router).
17Configure [deployment credentials](/neon/setup), then install in the app directory:
18
19Install [Alchemy and its matching Effect dependencies](/getting-started) first;
20use Node 24 for this build toolchain.
21
22```sh
23pnpm add -D @alchemy.run/frontend-frameworks @vercel/nft
24```
25
26Keep the `reactRouter()` plugin from `@react-router/dev/vite` in `vite.config.*`
27and your route configuration in the application. No separate listening server
28or deployment adapter is needed in the app.
29
30## Define the stack
31
32```typescript
33// alchemy.run.ts
34import * as Alchemy from "alchemy";
35import * as Neon from "alchemy/Neon";
36import * as Effect from "effect/Effect";
37
38export default Alchemy.Stack(
39 "NeonReactRouter",
40 { providers: Neon.providers(), state: Alchemy.localState() },
41 Effect.gen(function* () {
42 const site = yield* Neon.Website.ReactRouter("Web", {
43 rootDir: ".",
44 });
45 return { url: site.url };
46 }),
47);
48```
49
50The framework handler receives SSR, loader, action, and resource-route requests;
51static files are served from the Function artifact. Server loaders/actions can
52read `process.env`; Vite's `VITE_*` values are embedded in the browser build.
53Do not return private tokens from loaders or place them in public-prefixed values.
54
55## Develop and deploy
56
57```sh
58pnpm exec alchemy dev
59pnpm exec alchemy deploy
60pnpm exec alchemy destroy
61```
62
63Run separately, destroying when finished. Dev uses React Router's native Vite
64server and HMR, with a local URL and no implicit Neon resources. Append
65`.pipe(Alchemy.remote())` to the Website Effect to opt into live deployment during dev.
66
67Omitting scope creates an Ohio Project on deploy. Pass either `project` or
68`branch` for a shared backend, and choose Ohio when combining with storage. Read
69[scope and credentials](/neon/frontend/vite#scope-and-credentials) before wiring
70backend access.
71
72:::caution[Deployment limits]
73Complete live framework acceptance remains unverified. Neon probes have served
74old code/env after new deployment metadata became active. This constructor does
75not add a CDN or persistent application cache; custom-domain registration is not
76TLS validation. See the
77[shared deployment limits](/neon/frontend/vite#environment-and-deployment-limits).
78:::
79
80## Reference
81
82- [ReactRouter API](/providers/neon/website/reactrouter)
83- [Runnable React Router example](https://github.com/alchemy-run/alchemy/tree/main/examples/neon-website-react-router)