Skip to content

ReactRouter

Source: src/Railway/Website/ReactRouter.ts

Deploy a React Router v7 app (framework mode) to Railway: the SSR server plus client assets on one Railway.Service.

The build runs through @alchemy.run/frontend-frameworks/react-router with the @alchemy.run/frontend-frameworks/react-router/node deploy target — both must be installed in your project, alongside @react-router/dev, react-router, and vite.

Your vite.config.ts needs no adapter wiring. React Router’s server build is a ServerBuild manifest rather than a request handler, so the integration wraps the manifest with createRequestHandler and packages the resulting fetch handler as a Node HTTP server on port 3000.

React Server Components (React Router’s unstable RSC plugin) and multi-environment builds are not supported yet — the build fails with an actionable error when more than one server entry is emitted.

During alchemy dev the site is React Router’s own Vite dev server and no cloud resources are created. Alchemy.remote() opts back into the live Service path.

Basic React Router App

const site = yield* Railway.Website.ReactRouter("Web", {
rootDir: "./app",
});

Custom Domain

const site = yield* Railway.Website.ReactRouter("Web", {
rootDir: "./app",
domain: "app.example.com",
});

Process Environment

const site = yield* Railway.Website.ReactRouter("Web", {
rootDir: "./app",
env: {
GREETING: "Hello from React Router on Railway!",
},
});

Read An Environment Variable From A Loader

app/routes/home.tsx
export function loader() {
return { apiBase: process.env.API_BASE ?? "unset" };
}