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.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:- Clones your repository from the specified branch
- Installs production dependencies using
npm ci --omit=dev - Builds Docker image with Node.js 20 Alpine
- Sets up environment variables including PORT and START_CMD
- Deploys container with your specified start command and port
- 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
Nest.js
Fastify
Custom Build + Start
Validation Rules
DeployHub validates your configuration: 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:Health Checks
Implement health check endpoints in your application:Troubleshooting
Application Won’t Start
- Verify your
startCommandis 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
portin config matches your code - Ensure your app binds to
0.0.0.0, not justlocalhost:
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, notdevDependencies - The build uses
npm ci --omit=devwhich 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