Skip to main content
DeployHub supports deploying Node.js backend applications with customizable start commands and port configuration.

Supported Frameworks

  • Express.js
  • Fastify
  • Nest.js
  • Koa
  • Hapi
  • Any Node.js application with a start command

Project Type Configuration

When creating a deployment, you must set projectType: "node" for Node.js applications.

Required Configuration

Node.js applications require two mandatory fields:

Start Command

The command to start your application. This runs inside the Docker container. Common examples:

Port

The port your application listens on. Must match the port in your application code.
The port value must match the port your application binds to in code:

Deployment API Request

1

Prepare your deployment configuration

Create a deployment request with all required fields:
2

Send POST request to create deployment

3

Monitor deployment status

The build worker will:
  • Clone your repository
  • Install production dependencies with npm ci --omit=dev
  • Create a Docker image with Node.js 20 Alpine
  • Deploy the container with your start command

Environment Variables

Add runtime environment variables for your application:
Environment variables are passed to the container at runtime and are available to your Node.js application via process.env.

Build Process Details

When you deploy a Node.js application, DeployHub:
  1. Clones your repository from the specified branch
  2. Installs production dependencies using npm ci --omit=dev
  3. Builds Docker image with Node.js 20 Alpine
  4. Sets up environment variables including PORT and START_CMD
  5. Deploys container with your specified start command and port
  6. Connects to network for routing traffic

Dockerfile Template

DeployHub uses this Dockerfile for Node.js deployments:

Container Configuration

From the deploy worker source code:

Framework-Specific Examples

Express.js

server.js:

Nest.js

Fastify

app.js:

Custom Build + Start

Validation Rules

DeployHub validates your configuration:
Required for Node.js projects:
  • projectType must be "node"
  • startCommand is required and cannot be empty
  • port is required and must be a number
  • branchname is required
  • isFolder must be a boolean
From the validation schema:

Database Connections

For applications that need databases:
Make sure your database is accessible from DeployHub’s network. Use connection pooling for better performance.

Updating Runtime Settings

You can update runtime settings after deployment:
Changing these settings requires a redeployment to take effect.

Health Checks

Implement health check endpoints in your application:

Troubleshooting

Application Won’t Start

  • Verify your startCommand is correct
  • Check that the entry point file exists
  • Review application logs for errors
  • Ensure all dependencies are in package.json

Port Binding Issues

  • Verify the port in config matches your code
  • Ensure your app binds to 0.0.0.0, not just localhost:

Environment Variables Not Working

  • Check that variable names are correct
  • Verify you’re reading from process.env
  • Environment variables are available at runtime, not build time

Dependencies Missing

  • Ensure all dependencies are in dependencies, not devDependencies
  • The build uses npm ci --omit=dev which skips dev dependencies

Build Arguments

The build process passes these arguments to Docker:

Redeployment

Redeployments check for new commits and rebuild if necessary:

Next Steps

Deploy Static Sites

Learn how to deploy frontend applications

Monorepo Support

Deploy from specific folders in monorepos

Branch Management

Configure branch and commit tracking