Documentation

guides

Deploy a Node.js App

Deploy any Node.js application to Runix — Express, Fastify, Next.js, Nuxt, Remix, or plain Node.

Runix makes deploying Node.js apps effortless. Whether you're running Express, Fastify, Next.js, Nuxt, Remix, or a plain Node.js server, Runix detects your framework and handles everything automatically.

Prerequisites#

  • A Node.js project with a package.json file
  • A start script defined in your package.json
  • A Runix account (sign up free at runixcloud.dev)

Supported Frameworks#

FrameworkAuto-DetectedNotes
ExpressYesMost popular Node.js framework
FastifyYesFast and low-overhead
Next.jsYesConfigured with standalone output mode automatically
NuxtYesVue.js framework
RemixYesFull-stack React framework
Plain Node.jsYesAny HTTP server using http/https modules

Example Project#

Here's a minimal Express app to show you what Runix needs. If your project already has a package.json with a start script, you're good to go.

package.json
json
{
  "name": "my-api",
  "version": "1.0.0",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "express": "^4.18.0"
  }
}
server.js
javascript
const express = require("express");
const app = express();
const port = process.env.PORT || 3000;

app.get("/", (req, res) => {
  res.json({ message: "Hello from Runix!" });
});

app.listen(port, () => {
  console.log(`Server running on port ${port}`);
});

Configuration#

Run runix init in your project directory. Runix will detect Node.js from your package.json and generate a runix.yaml like this:

runix.yaml
yaml
name: my-api
services:
  - name: api
    type: web-service
    repo: https://github.com/yourname/my-api
    branch: main
    env:
      NODE_ENV: production

You don't need to set the PORT environment variable. Runix automatically assigns a port and injects it as the PORT environment variable at runtime.

How It Works#

When you run runix deploy, here's what happens behind the scenes:

  1. 1.Runix detects Node.js from your package.json
  2. 2.It reads your package.json to identify the framework (Express, Next.js, etc.)
  3. 3.An AI-powered engine generates a production-ready Dockerfile tailored to your project
  4. 4.Your app is built into a Docker container image
  5. 5.The container is deployed and given a public URL with HTTPS

You don't need to write a Dockerfile. Runix generates one using AI that's optimized for your specific project. If you want to customize it, you can add your own Dockerfile and Runix will use it instead.

Environment Variables#

VariableSet ByDescription
PORTRunix (automatic)The port your app should listen on. Always use process.env.PORT.
NODE_ENVYou (recommended)Set to "production" for deployed apps

Add your own environment variables in runix.yaml under the env section, or through the dashboard under your project's settings.

Next.js Apps#

Next.js apps are automatically configured with standalone output mode for optimal container size. Runix handles the next.config.js settings for you — no changes needed on your end.

For Next.js projects, Runix also handles static file serving and image optimization automatically. If your project uses an API route or server-side rendering, everything works out of the box.


Common Issues#

Missing start script#

If your deployment fails with a "start script not found" error, make sure your package.json has a "start" script in the "scripts" section:

json
"scripts": {
  "start": "node server.js"
}

App not responding (wrong port)#

Make sure your app listens on the port provided by the PORT environment variable, not a hardcoded port. This is the most common cause of "502" errors after deployment.

javascript
// Good - uses the PORT environment variable
const port = process.env.PORT || 3000;
app.listen(port);

// Bad - hardcoded port that may not match Runix's assigned port
app.listen(3000);