# Deploy React Router 7 in one sentence.

> Deploy React Router 7 with no Dockerfile, or say "deploy this" in Claude Code or Codex. Preview every version; PostgreSQL in one click.

Web page: https://agentlab.cresclab.com/en/deploy/react-router  
繁體中文 (Markdown): https://agentlab.cresclab.com/deploy/react-router.md

React Router 7 deploy guide · Agent Lab Deploy

Upload your React Router 7 project as it is — no Dockerfile — or tell Claude Code, Codex or Cursor "deploy this". Agent Lab builds it into a web service, or a static web page when it is fully static, gives every version a preview URL, and checks uploads for leaked keys.

[Start free](https://app.agentlab.cresclab.com/?lang=en&intent=deploy) [See the setup](https://agentlab.cresclab.com/en/deploy/react-router#recipe)

An AI coding tool deploys a React Router 7 project to Agent Lab: it creates the project, uploads, waits for the build and reports the live URL.

Why deploy React Router 7 on Agent Lab

## React Router 7 online without running a server yourself

JavaScript / TypeScript project, built from source with no Dockerfile, deployed as a web service, or a static web page when it is fully static.

### No Dockerfile

The platform detects React Router 7 from package.json, picks the build and start commands, and lists the environment variables your code reads.

### Preview, then go live

Every upload is a new version with its own URL. Look first, then go live.

### Leaked keys caught

Uploads are checked for API keys and credentials before they can go live. Secrets go in the console, never in the code.

### PostgreSQL in one click

Create a database and connect it; the connection is written into the app's environment and the password is never shown.

Your options

## React Router 7 on Agent Lab, or on your own VPS

Deploying React Router 7 on Agent Lab compared with a self-managed VPS

| What you care about | Agent Lab Deploy | Your own VPS |
| --- | --- | --- |
| Setup | Upload or say one sentence; no Dockerfile | SSH, a runtime, a process manager, a reverse proxy |
| HTTPS and domains | Automatic, custom domains on paid plans | Certbot and DNS by hand |
| Before going live | Uploads checked for leaked keys | Nothing unless you set it up |
| Database | PostgreSQL in one click, connection written into the app | Install and back it up yourself |
| Cost to start | Free plan: US$0, one size-S app (sleeps when idle) | A VPS at roughly US$6–20 a month, plus your time |

Steps

## Deploy React Router 7 in four steps

1. ### Prepare
   Keep package.json at the top of the project and commit the lockfile. Leave out node_modules, .git, dist and .env.
2. ### Upload or ask
   Drop the folder on a project's Deploy tab, push from GitHub, or ask your AI tool through Agent Lab MCP.
3. ### Build and check
   The platform builds the version and checks it for leaked keys. Enter any secrets it lists in Settings.
4. ### Preview and go live
   The first version goes live once it builds. Later ones get a preview URL; go live when you're happy.

Setup

## What Agent Lab runs for React Router 7

Framework mode (loaders, actions) deploys as a web service; an SPA with ssr: false in react-router.config deploys as a web page on the CDN. In an SPA every route (such as /orders/42) answers with index.html, so a reload never 404s.

Detected

### Build and start

```
# Agent Lab 偵測到 React Router 7（framework mode）後執行
# What Agent Lab runs once it detects React Router 7 (framework mode)
npm ci
npm run build      # react-router build
npm start          # react-router-serve，監聽 $PORT（預設 8080）

# ssr: false（SPA mode）→ 改成靜態網站，放 CDN
```

- `PORT` the port the platform gives (8080 by default); the server must listen on it.
- `SESSION_SECRET` generate it in the console.
- `DATABASE_URL` written for you when you connect an Agent Lab PostgreSQL.

Prompt

### Or ask your AI tool

```
Read https://app.agentlab.cresclab.com/agent/deploy.md and deploy this React Router 7 project to Agent Lab. Show me the build plan and the environment variables it needs first, tell me where to enter any secrets, and wait for my OK before it goes live.
```

FAQ

## Deploying React Router 7: questions

**Do I need a Dockerfile to deploy React Router 7?**

No. Upload the React Router 7 project with package.json at the top and Agent Lab detects the framework, builds it and starts it. A Dockerfile at the top, if there is one, is used instead. [Docs →](https://agentlab.cresclab.com/docs/en/deploy/source-build)

**Does React Router have to listen on PORT?**

Yes. The platform puts the port in the PORT environment variable (8080 by default); the server must listen on it, on all interfaces (0.0.0.0), not only localhost. A version that never becomes ready is almost always listening on the wrong port.

**Where do API keys and other secrets go?**

In the project's Settings, under Secrets; the code reads them as environment variables. Random values such as session secrets can be generated in the console without anybody seeing them. A key found in an upload stops it before it goes live.

**Can I deploy React Router 7 from Claude Code or Codex?**

Yes. Connect Agent Lab MCP once (one command, sign in in the browser, no API key), then say "deploy this React Router 7 app". The tool creates the project, uploads, waits for the build and asks before going live. [Connect MCP →](https://agentlab.cresclab.com/en/mcp)

**Is there a free way to host React Router 7?**

The Free plan is US$0: one size-S app that sleeps after 15 idle minutes, one size-S database, three static web pages, 100 build minutes and 5 GB of traffic a month, pausing at the limit instead of charging. Pro (US$29 a month before tax) keeps apps running and adds custom domains. [Pricing →](https://agentlab.cresclab.com/en/deploy#pricing)
