React Router
Deploy React Router framework-mode SSR or static SPA builds.
Nitroship supports React Router framework mode, including server rendering, loaders, and actions. A client-only React Router library app belongs under Vite SPA.
Detection and build output
- Detection:
@react-router/devinpackage.json; keep thereact-router buildscript. - With SSR enabled,
react-router-serve build/server/index.jsstarts the server.build/clientgoes to the CDN, and production dependencies are included in the server bundle. Put@react-router/serveindependencies. - With
ssr: falseinreact-router.config.ts,build/clientis deployed as a static SPA with an automatic/index.htmlfallback. This mode needs no compute region and cannot run server loaders or actions. - The preset expects the default framework build layout and the standard serve command; use a Dockerfile for a custom server adapter.
Deploy
Install the CLI
curl -fsSL https://nitroship.co/install.sh | bash
ntro loginAlready installed? Skip ahead. Full options, PATH setup, and updates: Install the CLI.
{
"build": {"framework": "react-router"},
"compute": {"regions": ["kr-icn"]}
}Setting build.framework skips detection and uses this preset, even if your project root has a Dockerfile. It can't be combined with build.dockerfile. Without it, Nitroship detects the build as described in How Nitroship chooses a build.
ntro apps create my-react-router-app
ntro deploy . --prodAfter installing dependencies, you can also build locally with ntro deploy . --prod --local. After deployment, open static assets and a server route at the URL printed by the CLI.
Static SPA mode
import type { Config } from "@react-router/dev/config";
export default { ssr: false } satisfies Config;For this mode, the compute block above is unnecessary. Open a nested route directly after deployment to check the SPA fallback.
Limits and custom setups
Server deployments need a compute region. Your server must listen on 0.0.0.0:$PORT (default 3000). Client assets come from the CDN, and a single Node server handles all SSR and API requests; routes aren't split into separate functions the way Next.js routes are.
Nitroship does not automatically run migrations, queue workers, or schedulers. Run migrations in CI or locally; see Scheduled jobs for periodic work. Store uploads in S3 or other object storage, and configure secrets through Environment variables.
For adapters or output layouts outside this contract, use your own Dockerfile. Remove build.framework and define installation, build, and startup in the Dockerfile.