Deploy a React app on Nept
This guide covers deploying a React app to Nept — whether you scaffolded it with Vite, Create React App, Remix, or a custom setup.
If your React app uses Vite specifically, see also Deploy a Vite app. If it uses Next.js, see Deploy a Next.js app.
Prerequisites
- A Nept account.
- A React project with a working
buildscript inpackage.json.
Option A: Deploy from GitHub
- Connect GitHub.
- Click New project and pick your React repository.
- Nept detects the framework and pre-fills the build command. If needed, override to
npm run build. - Set the output directory (
buildfor CRA,distfor Vite/others). - Add environment variables — remember that CRA and Vite have different env var conventions.
- Click Deploy.
Option B: Deploy with the CLI
terminal
npm install -g nept-cli
nept login
cd my-react-app
nept deploy --prod
Nept runs your build script and serves the output over a global CDN.
Environment variables
React frameworks each have their own env var prefix:
- Vite: variables must start with
VITE_to be exposed to the client. - Create React App: variables must start with
REACT_APP_. - Next.js: variables exposed to the browser must start with
NEXT_PUBLIC_.
Custom domains
Attach a custom domain from the dashboard or CLI. See Custom Domains.
Managed database
Full-stack React apps can attach a managed Postgres database:
terminal
nept db create --type postgres
See Databases.