Prepare your app
A project made with npx create-react-router@latest already has what it needs:
"scripts": {
"build": "react-router build",
"dev": "react-router dev",
"start": "react-router-serve ./build/server/index.js"
}react-router build writes the server to build/server and the browser assets to build/client. react-router-serve serves both, reads PORT (we set it) and listens on every interface unless you set HOST. Don't set HOST to localhost.
With the template's Dockerfile
We build the Dockerfile as written: Node 24 on Alpine, ending in npm run start. It has no ARG lines, so add one per build-time variable in the build stage (for example ARG VITE_API_URL) if your client code needs any.
Without a Dockerfile
We install from your lockfile, run the build script and start react-router-serve directly. This build uses Node 22.19 by default. That's fine for React Router 7, but React Router 8 asks for Node 22.22 or newer and its build prints Oops, Node v22.19.0 detected. Add the env var NIXPACKS_NODE_VERSION=24 to build and run on Node 24.10.
Coming from Remix
React Router 7 is the next major version of Remix v2. A Remix v2 app with a remix-serve ./build/server/index.js start script deploys here as it is, the same way: we run the start script.
To move to React Router, the official codemod handles most of the renames:
npx codemod remix/2/react-router/upgrade npm install
The parts that matter for deploys: @remix-run/serve becomes @react-router/serve, @remix-run/node becomes @react-router/node, the build script becomes react-router build and the start script becomes react-router-serve build/server/index.js. The server entry stays at build/server/index.js. Going on to React Router 8 needs Node 22.22+, React 19.2.7+ and Vite 7+, so set NIXPACKS_NODE_VERSION=24 as above.
SPA mode (ssr: false)
With ssr: false in react-router.config.ts, the build makes no server, only build/client with an index.html, so react-router-serve has nothing to run. To serve it as a static site:
- Remove the
startscript and the server-only packages@react-router/nodeand@react-router/serve. - Delete the template's Dockerfile, or set Builder to “Auto-detect stack (ignore Dockerfile)”.
- Add the env var
NIXPACKS_SPA_OUTPUT_DIR=build/client.
The app is then detected as a Vite single-page app and served by Caddy, which sends index.html for any path that isn't a file, so refreshing a deep link works. Without the variable, Caddy looks in dist/ and finds nothing.
Environment variables
Add variables in the project's settings. They're available both while the app builds and while it runs, so build-time values (like framework-public keys) work without extra setup. See Environment variables.
- Loaders and actions run on the server and can read any variable with
process.env, at request time. - Only
VITE_variables reach browser code, throughimport.meta.env. They're baked in at build time, so redeploy after changing one. With a Dockerfile build, the Dockerfile also has to declare them withARG.
Add a database
Add a Postgres addon and DATABASE_URL is injected automatically. Read it in loaders and actions, or in a .server.ts module so it can never be bundled for the browser. The database isn't reachable while the app builds, so run migrations in front of the Start command in Settings → Build, for example npx prisma migrate deploy && npm start.
Health check
Every deploy requests your health check path (/ by default) and only goes live once it returns a 2xx or 3xx status. The platform keeps checking it after that. If / returns 404 or needs a login, add a route like /healthz that returns 200 and set it as the Health Check Path in Settings. Otherwise the deploy fails and the previous version keeps serving.
Deploy React Router for free
The Free plan costs nothing and needs no card. It includes:
- One project, live over HTTPS at
<project-slug>.ethiodeploy.app. - 256 MB of memory and half a CPU core.
- A managed Postgres, MySQL or Redis addon with 512 MB of storage. It doesn't expire.
- A redeploy on every push, the same as the paid plans.
The catch is sleep. After 30 minutes without traffic the app stops, and the next request starts it again. We hold that request for up to 30 seconds while the app boots, so the first visitor after a quiet spell waits a little.
A React Router app fits the Free plan in one project: the server, loaders, actions and the Postgres addon. On 256 MB, the build without a Dockerfile helps a little, because we start react-router-serve directly while the template's Dockerfile keeps npm running next to it.
When the app has to stay awake or needs your own domain, Pro is $10 or 1,399 ETB a month: always on, 1 GB of memory and a 5 GB database.
Deploy
- Sign in with GitHub and install the EthioDeploy app on the repo.
- Click “New Project” and pick the repo.
- Watch the build in the dashboard. When the health check passes, your app is live at
<project-slug>.ethiodeploy.app. Every push to the default branch redeploys, and the old version keeps serving until the new one is healthy.
Troubleshooting
VITE_ variables are undefined in the browser after a Dockerfile build
Cause: The Dockerfile doesn't declare them with ARG, so the build never saw them.
Fix: Add ARG VITE_… lines to the build stage, or build without the Dockerfile.
Oops, Node v22.19.0 detected. react-router requires a Node version greater than 22.22.0
Cause: React Router 8 on the default Node 22.19 build.
Fix: Add the env var NIXPACKS_NODE_VERSION=24 and redeploy.
Cannot find module build/server/index.js
Cause: SPA mode (ssr: false) builds no server, but the start script still runs react-router-serve.
Fix: Turn SSR back on, or follow the SPA mode steps above.
SPA mode deploy shows a 404 or blank page
Cause: Caddy is serving dist/, but React Router writes build/client.
Fix: Add NIXPACKS_SPA_OUTPUT_DIR=build/client and redeploy.
The app runs but the deploy fails its health check
Cause: Your health check path returns 404, a 5xx, or needs a login.
Fix: Add a healthz route whose loader returns a 200 and set /healthz as the Health Check Path in Settings.
Still stuck? Check the deployment's build log in the dashboard, or see Troubleshooting.
Questions
Yes. React Router 7 is the next version of Remix v2. A Remix v2 app with a remix-serve start script deploys as it is, and after upgrading with the codemod the start script becomes react-router-serve build/server/index.js.
No. If it's in the repo we build it, and it works. Without it we install, run react-router build and start react-router-serve ourselves. On React Router 8, also add NIXPACKS_NODE_VERSION=24 in that case.
Yes. Remove the start script and the @react-router/node and @react-router/serve packages, skip the Dockerfile, and set NIXPACKS_SPA_OUTPUT_DIR=build/client. It's then served as a static site with an index.html fallback.
Yes. The Free plan runs one project with a 512 MB Postgres database at no cost. The app sleeps after 30 minutes without traffic and wakes on the next request, and the container has 256 MB of memory. Pro ($10/month) keeps it always on with 1 GB.
Ready to deploy?
Sign in with GitHub and pick your repo. No Dockerfile, no YAML.
More guides
All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.