Deploying

Build once, deploy to Node.js or Vercel. Public files land on the CDN automatically.

Build for production

terminalbash
npm run build

This produces a dist/ directory ready to run:

dist/bash
dist/
├── api/                    # Bundled API route handlers (.mjs)
├── pages/                  # Bundled SSR page handlers (.mjs)
├── static/
│   ├── __react.js          # React runtime
│   ├── __n.js              # NukeJS client runtime
│   ├── __client-component/ # "use client" component bundles
│   └── ...                 # Copied from app/public/
├── manifest.json           # Route dispatch table
└── index.mjs               # HTTP server entry point

Node.js

terminalbash
node dist/index.mjs

Set the port with the PORT env variable:

terminalbash
PORT=8080 ENVIRONMENT=production node dist/index.mjs

PM2 (process manager)

terminalbash
npm install -g pm2
pm2 start dist/index.mjs --name nukejs-app
pm2 save && pm2 startup

Vercel

Import your GitHub repo in the Vercel dashboard — no additional configuration needed. NukeJS auto-detects the Vercel build environment and outputs to .vercel/output/.

1

Push your project to GitHub

2

Go to vercel.com/new and import the repository

3

Click Deploy — Vercel runs npm run build and deploys automatically

Public files are CDN-hosted on VercelEverything in app/public/ lands on Vercel's CDN — served globally with zero latency and no function invocations.

Environment variables

Set secrets in your hosting platform's dashboard, or use a .env file for Node deployments. Access them in server code via process.env:

server/db.tstypescript
const uri = process.env.DATABASE_URL
if (!uri) throw new Error('DATABASE_URL is required')
🚫
Never read secrets in client componentsEnvironment variables accessed in "use client" files get bundled into the browser JavaScript and become public. Only read secrets in server components and API routes.