Guides
Node.js (Express)
A long-running Express (or Fastify/Koa/Nest) server — the files it needs, PORT, start command and common failures.
Create the app
- Apps → New app, pick the repository. With express (or fastify, koa, @nestjs/core, …) in package.json and no frontend bundler, detection suggests “Node service (Express)”. Choose Node.js Application.
- If the same repo also builds a React/Vite frontend that Express serves, detection suggests “React app with its own server” instead — see Supported app types.
What the repo needs
package.json
{
"scripts": { "start": "node server.js" },
"dependencies": { "express": "^4.21.0" }
}server.js
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('ok'));
app.get('/health', (req, res) => res.json({ ok: true }));
const port = process.env.PORT || 3000;
app.listen(port, '0.0.0.0', () => console.log('listening on ' + port));Shipyard assigns the port and injects it as PORT. Listen on process.env.PORT and bind 0.0.0.0 — a hard-coded port or localhost means the health check never reaches the app.
Settings
Install command: npm ci # falls back to npm install without a lockfile
Build command: npm run build # skipped automatically if there is no "build" script
Start command: npm start
Health check path: / # any route that returns 2xx/3xx, e.g. /health- After the build, devDependencies are pruned. Anything the server needs at runtime must be in dependencies — tsx, ts-node or nodemon in devDependencies won’t exist when npm start runs. For TypeScript, compile in the build script and start with node dist/server.js.
- The app runs with NODE_ENV=production. Its stdout/stderr is the runtime log on the deployment page.
Environment variables
- Read them from process.env (process.env.DATABASE_URL, process.env.API_KEY). Secrets are injected at build time and again when the container starts; redeploy after changing one.
Common failures
- “App didn’t respond on its assigned port” — the server listens on the wrong port/host, or crashed on boot. Use process.env.PORT and 0.0.0.0, then check the app output in the deploy log.
- “Health check returned 404 (app is running)” — there’s no route at the health check path. Add one, or set the path to a route you have.
- “Module … not found” at start — the package is missing from package.json, or it is only in devDependencies (pruned before start). Move it to dependencies.
- “Can’t connect to the database” — DATABASE_URL is missing or points nowhere. Attach a managed database with “Use in app”, then redeploy.

