EthioDeploy
DocsPricingDomainsBlogToolsChangelog
Deploy guides/React Router

Deploy a React Router app

A React Router app in framework mode deploys as it comes from the template: we run react-router-serve, which reads PORT and listens on every interface. Remix v2 apps work the same way. SPA mode takes one env var.

Last updated November 15, 2026

What we run by default
Detected by
Your Dockerfile if the repo has one, otherwise package.json
Install
npm ci / pnpm / yarn (from your lockfile)
Build
npm run build (react-router build)
Start
npm start (react-router-serve ./build/server/index.js)

These run automatically, so leave the command fields blank. Only override them in Settings → Build if you need something different.

Fix this first: The template's Dockerfile is what gets built

The default template includes a Dockerfile, and with the Builder setting on Auto we build a Dockerfile whenever the repo has one. That works, but the Install and Build commands in Settings are ignored, and env vars only reach the build if the Dockerfile declares them with ARG. To use our Node build instead, delete the Dockerfile or set Builder to “Auto-detect stack (ignore Dockerfile)”.

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:

  1. Remove the start script and the server-only packages @react-router/node and @react-router/serve.
  2. Delete the template's Dockerfile, or set Builder to “Auto-detect stack (ignore Dockerfile)”.
  3. 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, through import.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 with ARG.

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

  1. Sign in with GitHub and install the EthioDeploy app on the repo.
  2. Click “New Project” and pick the repo.
  3. 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

HonoStrapiLLovable

All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.

On this page
Prepare your appComing from RemixSPA mode (ssr: false)Environment variablesAdd a databaseHealth checkDeploy React Router for freeDeployTroubleshootingQuestions
Deploying with an agent?Point it at llms.txt. Every guide is in one file there.Open llms-full.txt →
EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiDjangoFastAPIFlaskStreamlitExpressNestJSLaravelRailsGoTelegram botDiscord botLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy