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#
| Framework | Auto-Detected | Notes |
|---|---|---|
| Express | Yes | Most popular Node.js framework |
| Fastify | Yes | Fast and low-overhead |
| Next.js | Yes | Configured with standalone output mode automatically |
| Nuxt | Yes | Vue.js framework |
| Remix | Yes | Full-stack React framework |
| Plain Node.js | Yes | Any 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.
{
"name": "my-api",
"version": "1.0.0",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.18.0"
}
}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:
name: my-api
services:
- name: api
type: web-service
repo: https://github.com/yourname/my-api
branch: main
env:
NODE_ENV: productionYou 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.Runix detects Node.js from your package.json
- 2.It reads your package.json to identify the framework (Express, Next.js, etc.)
- 3.An AI-powered engine generates a production-ready Dockerfile tailored to your project
- 4.Your app is built into a Docker container image
- 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#
| Variable | Set By | Description |
|---|---|---|
| PORT | Runix (automatic) | The port your app should listen on. Always use process.env.PORT. |
| NODE_ENV | You (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:
"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.
// 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);