Skip to main content
Betadocs
DocsStatusSupportPricing
  • Introduction
    • Introduction to Webgune
    • How Webgune works
    • Creating an account
    • Creating your first project
    • Exploring the dashboard
  • Deployment

    • Deploying from GitHub
    • Deploying a Docker image
    • How builds work
    • Deployments and rollback
    • Environment variables
    • Custom start command
    • Health check
    • Database migrations

    Web apps

    • Web applications
      • Supported frameworks
      • Next.js
      • React / Vite
      • Node.js
      • Python
      • PHP
      • Go

    Bots & workers

    • Discord bots
    • Workers

    Docker

    • Docker
      • Writing a Dockerfile
      • Public Docker images

    Databases

    • Databases
      • PostgreSQL
      • MySQL
      • MariaDB
      • MongoDB
      • Redis

    Observability

    • Logs and monitoring
    • Web terminal

    Scaling

    • Availability and scaling
    • Persistent volumes
    • Backups and restore
    • Sleep mode

    Platform

    • One microVM per service
    • Network and isolation
    • Platform security
    • Deploying a template
      • Template catalog
    • Free subdomains
    • Custom domains
    • Buying a domain
    • Hosting DNS for a domain bought elsewhere
    • Managing your DNS records
    • SSL certificates
    • Redirects
    • Shared projects
      • Roles and permissions
    • Real-time collaboration
    • Continuous deployment
      • The kx712.yml file
    • VS Code extension
    • Plans and pricing
    • Payments and invoices
    • Account or per-project subscription
    • API reference
    • API keys
    • Webgune CLI
    • MCP server
    • JavaScript / TypeScript SDK
    • Support tickets
    • Status page
    • AI assistant
    • FAQ
    • Limits and resources
    • Account security
    • Best practices
    • Troubleshooting

Services / Web applications

Node.js

Open as Markdown

A repository with a package.json is built as a Node.js project. If no more specific framework is recognized (Next.js, Nuxt, NestJS...), Webgune looks for an Express, Fastify, Koa or Hono server, or a start script. The full list is on Supported frameworks.

What the build runs

StepCommand
Installnpm ci --include=dev, or the frozen install of bun, pnpm or yarn depending on the lock file
Repository install scriptspreinstall, install, postinstall, prepare if they exist, after installation
Buildnpm run build, if the script exists
Startnpm start, or the inferred command (see below)

The runtime image starts from node:<version>-alpine, receives the built /app folder, and runs under the node user (uid 1000) with NODE_ENV=production. It contains neither a compiler nor Git.

Node.js version

Node.js 22 by default. For another version, add an .nvmrc file:

20

or a range in package.json:

{
  "engines": { "node": ">=20 <23" }
}

.nvmrc, .node-version and volta.node come first, provided they respect engines.node. A range alone gives 22 if it accepts it, otherwise the most recent LTS version it accepts. >=18 therefore gives 22, not 18.

The lock file

Committed fileInstall
package-lock.jsonnpm ci --include=dev
bun.lock or bun.lockbbun install --frozen-lockfile
pnpm-lock.yamlpnpm install --frozen-lockfile
yarn.lockyarn install --frozen-lockfile (Yarn 1) or yarn install --immutable (Yarn 2 and later)

The install never modifies the file. If it is missing or out of date with package.json, the build fails with a message that says what to do: run the install locally and commit the file. Two builds of the same commit install the same versions.

Development dependencies (devDependencies) are installed: TypeScript, Vite or Prisma CLI are available during the build. They remain present in the runtime image.

Start command

In order:

  1. the start script in package.json (npm start);
  2. the main field, if it points to an existing file: node <main>;
  3. the first existing file among the framework's usual entry points (index.js, server.js, app.js, then the same under src/ for Express);
  4. otherwise the first one in that list, assuming the build produces it.

An explicit start script avoids any surprise:

{
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  }
}

The command can also be replaced in the service settings (Custom start command).

Listening on PORT and 0.0.0.0

// Correct
app.listen(process.env.PORT || 3000, "0.0.0.0");

// The service starts but receives no requests
app.listen(3000, "localhost");

localhost refers to the service's own machine: requests coming from outside do not reach it. The service never becomes ready and the deployment fails.

Express

import express from "express";

const app = express();
app.use(express.json());
app.set("trust proxy", true);

app.get("/healthz", (_req, res) => res.send("ok"));

const port = Number(process.env.PORT) || 3000;
const server = app.listen(port, "0.0.0.0", () => console.log(`listening on ${port}`));

process.on("SIGTERM", () => server.close(() => process.exit(0)));

trust proxy makes Express read the visitor's address from the X-Forwarded-For header (req.ip) and the HTTPS protocol (req.secure).

Fastify

import Fastify from "fastify";

const app = Fastify({ logger: true, trustProxy: true });
app.get("/healthz", async () => "ok");

await app.listen({ port: Number(process.env.PORT) || 3000, host: "0.0.0.0" });

Fastify listens on 127.0.0.1 by default: the host: "0.0.0.0" option is essential.

Hono

import { serve } from "@hono/node-server";
import { Hono } from "hono";

const app = new Hono();
app.get("/healthz", (c) => c.text("ok"));

serve({ fetch: app.fetch, port: Number(process.env.PORT) || 3000, hostname: "0.0.0.0" });

TypeScript

Compile at build time and start on the produced JavaScript. tsx or ts-node in production lengthen startup and keep all the tooling in memory.

{
  "scripts": {
    "build": "tsc -p tsconfig.json",
    "start": "node dist/server.js"
  }
}

Prisma

A postinstall: prisma generate works: your repository's install scripts run after installation, with the build variables, so with DATABASE_URL. openssl, required by Prisma, is in the image. Migrations (prisma migrate deploy) cannot run at build time, which has no access to the database: see Database migrations.

Native modules

The compiler (python3, make, g++) is present during the build: bcrypt, sqlite3 or sharp compile if no binary exists for Alpine. The system libraries for canvas, puppeteer, fluent-ffmpeg, pg-native and a few others are added automatically (Supported frameworks). Playwright does not work on Alpine: use Puppeteer, or a Debian-based Dockerfile.

Private npm registry

Add an .npmrc file to the repository that reads the token from a variable:

//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@my-org:registry=https://npm.pkg.github.com

then create the NPM_TOKEN variable in the Variables panel. The NPM_TOKEN, NODE_AUTH_TOKEN, BUN_AUTH_TOKEN, YARN_NPM_AUTH_TOKEN and GITHUB_PACKAGES_TOKEN tokens are the only service variables available during dependency installation, along with the NPM_CONFIG_* settings.

Several processes

The image launches a single process. To use several cores, increase the number of instances (Availability and scaling) rather than using PM2's cluster mode. If the application crashes, Webgune restarts it: a process supervisor is not needed.

A background task (message queue, sending emails) is deployed separately, as a worker.

Common errors

SymptomCauseWhat to do
Deployment fails, no error in the logsListening on localhost or on a fixed portapp.listen(process.env.PORT, "0.0.0.0")
Cannot find module '/app/dist/index.js'The build script does not produce this fileAlign start with the build's actual output
npm ci rejects the lock fileFile out of date with package.jsonnpm install locally, then commit
Stop with code 137Service memory exceededSee Limits and resources

Updated on November 20, 2026

React / VitePreviousPythonNext

On this page

What the build runsNode.js versionThe lock fileStart commandListening on PORT and 0.0.0.0ExpressFastifyHonoTypeScriptPrismaNative modulesPrivate npm registrySeveral processesCommon errors
© 2026 WebguneBack to the site