Deploying
Build once, deploy to Node.js, Vercel, or Cloudflare. Zero configuration needed — NukeJS detects the environment automatically.
Build for production
npm run buildThis produces a dist/ directory ready to run:
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 pointNode.js
node dist/index.mjsSet the port with the PORT env variable:
PORT=8080 ENVIRONMENT=production node dist/index.mjsPM2 (process manager)
npm install -g pm2
pm2 start dist/index.mjs --name nukejs-app
pm2 save && pm2 startupVercel
Import your GitHub repo in the Vercel dashboard — no additional configuration needed. NukeJS auto-detects the Vercel build environment and outputs to .vercel/output/.
Push your project to GitHub
Go to vercel.com/new and import the repository
Click Deploy — Vercel runs npm run build and deploys automatically
app/public/ lands on Vercel's CDN — served globally with zero latency and no function invocations.Cloudflare
Import your GitHub repo in the Cloudflare dashboard — no additional configuration needed. NukeJS auto-detects the Cloudflare build environment and outputs to .cloudflare/output/.
Push your project to GitHub
Go to dash.cloudflare.com, open Workers & Pages and connect your repository
Click Deploy — Cloudflare runs npm run build and deploys automatically
The build output:
.cloudflare/output/
├── _worker.mjs # Single ESM Worker (all routes bundled)
└── static/
├── __n.js # NukeJS client runtime
├── __client-component/ # "use client" component bundles
└── ... # Copied from app/public/app/public/ lands on Cloudflare's global CDN — served with zero latency and no Worker invocations..cloudflare/output in the dashboard. For standalone Workers via wrangler deploy, static assets are inlined into the Worker bundle automatically — no extra step needed.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:
const uri = process.env.DATABASE_URL
if (!uri) throw new Error('DATABASE_URL is required')"use client" files get bundled into the browser JavaScript and become public. Only read secrets in server components and API routes.