Skip to content

Develop and deploy a React + Vite app on your own VM

A live Vite dev server at a private HTTPS address, and production on the same VM.

Deploy on exe.dev

Shelley handles the setup. About 10 minutes.

Prefer a terminal?
curl -fsSL https://exe.dev/deploy/react-vite/prompt.txt | ssh exe.dev new --prompt=/dev/stdin

Vite's dev server updates the page as you save. On an exe.dev VM it runs all the time at a private HTTPS address, https://my-react-vite.exe.xyz:5173/, so you can watch Shelley, Claude Code, or Codex change your app from any browser. When it's ready, one command builds it and nginx serves it at https://my-react-vite.exe.xyz/.

This page sets up a new React + TypeScript app with a small API, or your Vite app from GitHub, and covers the proxy settings that trip people up (allowedHosts, the HMR WebSocket).

What you get#

  • Node.js 26 and the app in ~/app, a git repository; with REPO=new, a React + TypeScript app with a Hono API in server/.
  • The Vite dev server (vite-dev.service) at https://my-react-vite.exe.xyz:5173/, with hot reload.
  • For an app with server/index.ts, its API (api-dev.service) on port 3001, behind Vite's /api proxy.
  • ~/bin/publish, which builds a release that nginx serves at https://my-react-vite.exe.xyz/, with the API as api.service; the first release published.
  • Secrets in ~/app.env (mode 600), read only by the API.
What's running, and where
Private https://my-react-vite.exe.xyz:5173/ The Vite dev server, with hot reload
Private https://my-react-vite.exe.xyz/ The published production build, until you make it public
my-react-vite.exe.xyz exe.dev VM
Vite 8 dev server React 19 + TypeScript, hot reload; vite-dev.service :5173~/app, a git repository
The API Hono 4 on Node.js; api-dev.service from ~/app (3001), api.service from the published release (3000) :3001
nginx serves the published build, with index.html for every app route, and proxies /api :8000/var/www/app/releases
Node.js 26 LTS NodeSource's apt package; npm, plus pnpm and Yarn through Corepack

Deploy with Shelley#

Click Deploy and Shelley will set up React + Vite on a new VM, then check that it works. No config-file wrangling required.

Have these ready; Shelley asks for them:

  • REPO: the GitHub repository of a Vite app to work on, as owner/name or a URL, or new to start a fresh React + TypeScript app with a small API
Prefer a terminal?
curl -fsSL \
  https://exe.dev/deploy/react-vite/prompt.txt \
  | ssh exe.dev new --prompt=/dev/stdin
What Shelley is told
REPO=<fill-this-in>

Set up React + Vite on this VM by following the exe.dev recipe at https://exe.dev/deploy/react-vite.md?via=deploy from top to bottom.

The values at the top of this message are mine:
- REPO: the GitHub repository of a Vite app to work on, as owner/name or a URL, or `new` to start a fresh React + TypeScript app with a small API
Ask me for any that still say <fill-this-in> before you need them.

The recipe's example VM name is my-react-vite. This VM's name is the output of `hostname`: use it wherever the recipe writes my-react-vite. Skip the step that creates the VM; you are on it.

You are done when all of these are true. Check each one yourself:
- Node.js 26 and the app in ~/app, a git repository; with REPO=new, a React + TypeScript app with a Hono API in server/.
- The Vite dev server (vite-dev.service) at https://my-react-vite.exe.xyz:5173/, with hot reload.
- For an app with server/index.ts, its API (api-dev.service) on port 3001, behind Vite's /api proxy.
- ~/bin/publish, which builds a release that nginx serves at https://my-react-vite.exe.xyz/, with the API as api.service; the first release published.
- Secrets in ~/app.env (mode 600), read only by the API.

Follow "Set up by hand" from "Install Node.js" on; the sections above it
are for the owner afterwards.

Finish with the URLs I should open.

Also at /deploy/react-vite/prompt.txt. The recipe it follows is /deploy/react-vite.md.

Open the dev server#

Open https://my-react-vite.exe.xyz:5173/. A new app shows a counter and The API says you're you@example.com: your exe.dev email, from a header exe.dev's proxy adds.

Click the counter, then edit the app on the VM (ssh my-react-vite.exe.xyz):

sed -i 's/React + Vite on exe.dev/Hello from my VM/' ~/app/src/App.tsx

The heading changes without a reload, and the count stays: React Fast Refresh, through exe.dev's proxy. Edits to server/index.ts restart the API. Both run as systemd services and survive reboots. Logs:

journalctl -u vite-dev -u api-dev -f

Edit with Shelley, Claude Code, or Codex#

Ask Shelley at https://my-react-vite.shelley.exe.xyz/ for something visible, such as "Add a dark mode toggle", with the preview open in another tab.

Claude Code and Codex are on the VM too. Connect them to exe.dev's LLM integration with exeuntu configure claude or exeuntu configure codex (Claude Code), and run them in tmux:

tmux new -A -s agent -c ~/app

~/app/AGENTS.md tells agents the dev server is already running, so they don't start a second one. VS Code and Cursor connect over Remote SSH, or run code-server for VS Code in the browser.

Share the preview#

A Web share gives someone the published build at https://my-react-vite.exe.xyz/, after they sign in to exe.dev. On your computer:

ssh exe.dev share add my-react-vite teammate@example.com

The dev server on port 5173 needs Root access, which also gives SSH and Shelley on the VM. Keep it for people you'd trust with everything on it:

ssh exe.dev share add my-react-vite teammate@example.com --root

ssh exe.dev share remove my-react-vite teammate@example.com takes access away (sharing).

Vite behind the exe.dev proxy#

exe.dev's HTTPS proxy forwards https://my-react-vite.exe.xyz:5173/ to port 5173 on the VM. The new app's vite.config.ts:

import { hostname } from 'node:os'

// exe.dev's HTTPS proxy sends Host: <vm>.exe.xyz, which Vite refuses unless it's allowed.
const exeHost = `${hostname()}.exe.xyz`

export default defineConfig({
  // ...plugins
  server: {
    port: 5173,
    strictPort: true,
    allowedHosts: [exeHost],
    proxy: {
      // The API in server/ listens on port 3001 in development.
      '/api': 'http://127.0.0.1:3001',
    },
  },
})
  • allowedHosts is the one setting you need. Without it, Vite answers Blocked request. This host ("my-react-vite.exe.xyz") is not allowed. Add your custom domain here too. Don't use true.
  • strictPort fails instead of quietly moving to 5174.
  • proxy puts the API on the same origin: no CORS, and the API sees the exe.dev headers.

You don't need server.host (--host, 0.0.0.0) or any server.hmr setting: the proxy connects to 127.0.0.1 and passes the HMR WebSocket through. A small plugin in the config prints the exe.dev address next to Vite's localhost one.

An API next to the app#

server/index.ts is a few lines of Hono, which Node.js runs as TypeScript with no build step:

app.get('/me', (c) => c.json({ email: c.req.header('x-exedev-email') ?? null }))

In development, api-dev.service runs it on port 3001 with node --watch, behind Vite's /api proxy. In production, nginx sends /api to api.service on port 3000. The app calls /api/... either way.

On a private VM every request carries X-ExeDev-Email and X-ExeDev-UserID, and the proxy strips any a visitor sends (login with exe). On a public site, send visitors to /__exe.dev/login?redirect=/ when you need to know who they are.

Other backends (Express, FastAPI, Go) work the same way: run one on 127.0.0.1 under systemd and point /api at its port. For a database, see SQLite or PostgreSQL.

Publish to production#

The dev server is for working, not for visitors. To publish, on the VM:

~/bin/publish

publish runs npm run build, copies dist/ and the API into a new release under /var/www/app/releases, switches to it, and checks that it answers. A failed build changes nothing, and a release that doesn't answer is rolled back. ~/bin/publish --rollback returns to the previous one.

nginx serves the build with compression, a long cache for /assets/, and index.html for every other path. Check https://my-react-vite.exe.xyz/, then make it public, on your computer:

ssh exe.dev share set-public my-react-vite

That opens only port 8000; the dev server stays private. ssh exe.dev share set-private my-react-vite closes it. For your own domain, point a CNAME at my-react-vite.exe.xyz and run ssh exe.dev domain add my-react-vite app.example.com (custom domains).

With React Router, paths like /settings/profile exist only in the browser. Both servers answer unknown paths with index.html, so reloads and bookmarks work; /api/ goes to the API, and missing /assets/ files stay 404s. To serve the app under /app/, set base: '/app/' in vite.config.ts and basename="/app" on the router.

Environment variables and secrets#

Anything named VITE_* is compiled into the JavaScript the browser downloads. Use it for public settings only, in ~/app/.env:

echo 'VITE_APP_TITLE=My app' >> ~/app/.env

Read it as import.meta.env.VITE_APP_TITLE. Restart vite-dev and publish again after a change.

Secrets go in ~/app.env (mode 600), which only the API services read:

nano ~/app.env
sudo systemctl restart api-dev api

Better, keep keys off the VM: the LLM integration at https://llm.int.exe.xyz/v1 needs no key, and an HTTP proxy integration adds tokens for other APIs on exe.dev's side.

Call your API from scripts#

Scripts and CI jobs get 401 from a private VM. Give them a VM token (HTTPS tokens for VMs). On your computer:

ssh exe.dev ssh-key generate-api-key --vm=my-react-vite --label=scripts

Then:

curl -H "X-Exedev-Authorization: Bearer $TOKEN" https://my-react-vite.exe.xyz/api/me

It returns your email: requests with a token act as you. The token also works on port 5173, and as a Basic auth password.

Keep your work#

Commit in ~/app as you go, and push with exe.dev's GitHub integration, which keeps the token off the VM. For an empty GitHub repository, on your computer:

ssh exe.dev integrations add github --name react-vite-repo --repository OWNER/NAME --attach vm:my-react-vite

and on the VM:

cd ~/app
git remote add origin https://github.int.exe.xyz/OWNER/NAME.git
git push -u origin main

Keep a copy of ~/app.env too. For whole-disk backups, see VM backups; for a staging copy, dev, test, and prod.

The nuts and bolts#

The setup steps Shelley follows, to run by hand, and commands for later.

Set up by hand

Create the VM#

On your computer (pick another name if my-react-vite is taken):

ssh exe.dev new --name=my-react-vite
ssh my-react-vite.exe.xyz

Everything else runs on the VM, as exedev.

Install Node.js#

The image has no Node.js. Install Node.js 26 LTS from NodeSource, so apt upgrade keeps it patched:

curl -fsSL https://deb.nodesource.com/setup_26.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g corepack && sudo corepack enable
node --version

Expect v26.x.y. Corepack provides pnpm and yarn.

Get the code#

The app lives in ~/app.

Start a new app (REPO=new) with create-vite, plus Hono for the API:

cd ~
npm create -y vite@9 app -- --template react-ts --no-interactive
cd ~/app
npm install
npm install hono@4 @hono/node-server@2
npm pkg set scripts.dev:api="node --watch server/index.ts"
sed -i 's/"include": \["vite.config.ts"\]/"include": ["vite.config.ts", "server"]/' tsconfig.node.json
grep '"include"' tsconfig.node.json

The last line should print "include": ["vite.config.ts", "server"], so tsc -b checks the API too.

The Vite config (explained above):

cat > ~/app/vite.config.ts <<'EOF'
import { hostname } from 'node:os'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'

// exe.dev's HTTPS proxy sends Host: <vm>.exe.xyz, which Vite refuses unless it's allowed.
const exeHost = `${hostname()}.exe.xyz`

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    react(),
    {
      // Print the address to open, next to Vite's http://localhost:5173/.
      name: 'exe-dev-url',
      configureServer(server) {
        const printUrls = server.printUrls
        server.printUrls = () => {
          printUrls()
          server.config.logger.info(`  ➜  exe.dev: https://${exeHost}:${server.config.server.port}/`)
        }
      },
    },
  ],
  server: {
    port: 5173,
    strictPort: true,
    allowedHosts: [exeHost],
    proxy: {
      // The API in server/ listens on port 3001 in development.
      '/api': 'http://127.0.0.1:3001',
    },
  },
})
EOF

The API:

mkdir -p ~/app/server
cat > ~/app/server/index.ts <<'EOF'
import { serve } from '@hono/node-server'
import { Hono } from 'hono'

const app = new Hono().basePath('/api')

app.get('/health', (c) => c.json({ ok: true }))

// exe.dev's proxy adds X-ExeDev-Email for people signed in to exe.dev
// (and drops any a visitor sends), so the API knows who's asking.
app.get('/me', (c) => c.json({ email: c.req.header('x-exedev-email') ?? null }))

const port = Number(process.env.PORT ?? 3001)
const server = serve({ fetch: app.fetch, hostname: '127.0.0.1', port }, (info) => {
  console.log(`API listening on http://127.0.0.1:${info.port}/api`)
})
// systemd sends SIGTERM on restart: finish requests in flight, then exit.
process.on('SIGTERM', () => server.close(() => process.exit(0)))
EOF

The page (App.tsx):

curl -fsSL https://exe.dev/deploy/react-vite/App.tsx -o ~/app/src/App.tsx

Notes for coding agents, and the first commit:

cd ~/app
cat > AGENTS.md <<'EOF'
# Working on this app

React + Vite + TypeScript, with a small Hono API in server/.

- The dev server is already running with hot reload (vite-dev.service, port 5173), as is
  the API (api-dev.service, port 3001). Don't start another `npm run dev`.
  Logs: `journalctl -u vite-dev -u api-dev -n 50`.
- Check your work with `npm run build`.
- `~/bin/publish` builds and serves production on port 8000. Only publish when asked.
- Secrets go in ~/app.env, never in VITE_* variables, which end up in the browser.
EOF
echo '@AGENTS.md' > CLAUDE.md
git init -q -b main
git add -A
git -c user.name="$(hostname)" -c user.email="exedev@$(hostname).exe.xyz" commit -qm "React + Vite app with a Hono API"
git log --oneline

Bring your GitHub repository. A public one clones directly:

git clone https://github.com/OWNER/NAME.git ~/app

For a private one, connect GitHub on the Integrations page and attach the repository to the VM, on your computer:

ssh exe.dev integrations add github --name react-vite-repo --repository OWNER/NAME --attach vm:my-react-vite

Then clone through the integration on the VM:

git clone https://github.int.exe.xyz/OWNER/NAME.git ~/app

A 403 or "not found" means the integration isn't attached yet. Install packages with the repository's package manager:

cd ~/app
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
if [ -f pnpm-lock.yaml ]; then pnpm install
elif [ -f yarn.lock ]; then yarn install
else npm install
fi

Add port, strictPort and allowedHosts (with the hostname import and exeHost) to its Vite config, as in the new app's, and proxy if it has an API on the VM. Commit on a branch:

git switch -c exe-dev
git -c user.name="$(hostname)" -c user.email="exedev@$(hostname).exe.xyz" commit -qam "Configure Vite for exe.dev"

Start the dev server#

A secrets file, then the services (the API only with server/index.ts):

[ -e ~/app.env ] || install -m 600 /dev/null ~/app.env
sudo tee /etc/systemd/system/vite-dev.service >/dev/null <<'EOF'
[Unit]
Description=Vite dev server for ~/app, at https://%H.exe.xyz:5173/
After=network.target

[Service]
User=exedev
WorkingDirectory=/home/exedev/app
ExecStart=/usr/bin/npm run dev
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target
EOF
sudo tee /etc/systemd/system/api-dev.service >/dev/null <<'EOF'
[Unit]
Description=Development API for ~/app on port 3001, restarted on every change
After=network.target

[Service]
User=exedev
WorkingDirectory=/home/exedev/app
EnvironmentFile=/home/exedev/app.env
Environment=PORT=3001
ExecStart=/usr/bin/npm run dev:api
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now vite-dev.service
if [ -f ~/app/server/index.ts ]; then sudo systemctl enable --now api-dev.service; fi
sleep 3; journalctl -u vite-dev -n 8 --no-pager -o cat

Expect ready in and the exe.dev address. Check that it answers for the VM's name, and the API through it:

curl -s -o /dev/null -w '%{http_code}\n' -H "Host: $(hostname).exe.xyz" http://localhost:5173/
curl -s -H 'X-ExeDev-Email: setup@example.com' http://localhost:5173/api/me; echo

Expect 200 (403 means allowedHosts is wrong) and, for a new app, {"email":"setup@example.com"}.

Set up production#

Replace the image's placeholder nginx site with one on port 8000 that serves the published release:

sudo install -d -o exedev -g exedev /var/www/app /var/www/app/releases
sudo tee /etc/nginx/sites-available/app >/dev/null <<'EOF'
# The production build of ~/app, published by ~/bin/publish.
server {
    listen 8000;
    listen [::]:8000;
    root /var/www/app/current/dist;

    gzip on;
    gzip_types text/css application/javascript application/json image/svg+xml;

    # Vite fingerprints everything in /assets/, so a file there never changes.
    location /assets/ {
        add_header Cache-Control "public, max-age=31536000, immutable";
        try_files $uri =404;
    }

    # The API, from the same release (api.service).
    location /api/ {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    }

    # Everything else: the file if there is one, or index.html, so that
    # React Router's /some/page works on reload and from a bookmark.
    location / {
        add_header Cache-Control "no-cache";
        try_files $uri /index.html;
    }
}
EOF
sudo ln -sf /etc/nginx/sites-available/app /etc/nginx/sites-enabled/app
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl enable --now nginx.service
sudo systemctl reload nginx.service

Expect test is successful. The production API, run from the release:

sudo tee /etc/systemd/system/api.service >/dev/null <<'EOF'
[Unit]
Description=Production API for the published app, on port 3000
After=network.target

[Service]
User=exedev
WorkingDirectory=/var/www/app/current
EnvironmentFile=/home/exedev/app.env
Environment=NODE_ENV=production PORT=3000
ExecStart=/usr/bin/node server/index.ts
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
if [ -f ~/app/server/index.ts ]; then sudo systemctl enable api.service; fi

Install the publish script and publish:

mkdir -p ~/bin
curl -fsSL https://exe.dev/deploy/react-vite/publish -o ~/bin/publish
chmod +x ~/bin/publish
~/bin/publish

Expect Published <time>: https://my-react-vite.exe.xyz/. If the build writes somewhere other than dist/, change the cp -a dist line and nginx's root.

Check#

systemctl is-enabled vite-dev nginx; systemctl is-active vite-dev nginx
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:8000/some/app/route
curl -s -H 'X-ExeDev-Email: setup@example.com' http://localhost:8000/api/me; echo

Expect enabled and active twice each, 200, and, for a new app, {"email":"setup@example.com"}. Done: open the dev server.

Update Vite, React, and Node.js

Vite and React, on the VM:

cd ~/app
npm outdated
npm update
npm run build && git commit -qam "Update dependencies"

npm update stays within major versions. For a major upgrade, read the migration guide (Vite, React) and npm install vite@latest. Then sudo systemctl restart vite-dev api-dev, and publish.

Node.js patches come with apt:

sudo apt-get update && sudo apt-get install -y nodejs
sudo systemctl restart vite-dev api-dev api
node --version

For a new major version, change the number in the setup_ URL in Install Node.js and reinstall.

Something not working?

On the VM, the logs:

journalctl -u vite-dev -u api-dev -n 100 --no-pager   # development
journalctl -u api -n 100 --no-pager; sudo tail /var/log/nginx/error.log   # production
  • Blocked request. This host ("my-react-vite.exe.xyz") is not allowed. Add the VM to server.allowedHosts; Vite restarts when you save.
  • Changes don't appear until you reload, and the console shows a failed wss:// connection. Remove server.hmr settings from the Vite config. A 401 there means your exe.dev session ended: reload.
  • Port 5173 is already in use. Something started a second dev server, usually an agent. Find it with sudo ss -ltnp | grep 5173 and stop it.
  • http proxy error: /api/... in the Vite log. The API isn't running: journalctl -u api-dev.
  • ~/bin/publish stops at tsc -b. Fix the TypeScript errors it prints; the dev server doesn't check types.
  • The new release doesn't answer. The new API crashed: journalctl -u api -n 50. The previous release is still served.
  • import.meta.env.VITE_SOMETHING is undefined. The name must start with VITE_; restart vite-dev, and publish again.
  • exe.dev's error page. Nothing is listening on that port: systemctl status vite-dev nginx.

Frequently asked questions#

Do I need server.host 0.0.0.0, or HMR settings like clientPort 443?

No. exe.dev's HTTPS proxy connects to 127.0.0.1, where Vite listens, and passes the HMR WebSocket through. Remove server.hmr settings from other guides: clientPort: 443 sends the WebSocket to port 8000, not to Vite.

Can I use vite preview in production?

Vite says it isn't a production server. For a last look, npx vite preview in ~/app serves the build at https://my-react-vite.exe.xyz:4173/; nginx serves the real site.

Which versions does this install?

As of November 21, 2026: Node.js 26.13, Vite 8.3 (create-vite 9.3), React 19.3, TypeScript 7.0, Hono 4.13, and nginx 1.24.

Who can see my dev server?

You, and people with Root access to the VM. A Web share or share link covers only the shared port. Don't make the dev server public; publish instead.

Can I use pnpm or Yarn?

Yes. Corepack provides both, and setup uses your lockfile. ~/bin/publish installs the API's packages with npm ci, so an app with server/ needs a package-lock.json.

How is this different from deploying to Vercel or Netlify?

They host the build; this VM also runs your dev server, API, and coding agent. You give up a global CDN: one VM in one region is plenty for internal tools and most apps. See Migrate from Netlify.

How big a VM does a React + Vite app need?

The default (2 vCPUs, 8 GB of memory) is plenty: the new app's services use about 350 MB, and a build takes under a second. Large test suites benefit from more CPUs.

Published Nov 21, 2026 · Updated Nov 21, 2026 · tested end to end Nov 21, 2026 · Markdown · manifest.json · Something wrong? Tell us