Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Model Context Protocol
    • Vector Database
    • Working with AI
    • Heroku Inference
      • Quick Start Guides
      • Inference API
      • Inference Essentials
      • AI Models
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Language Support
  • Node.js
  • Node.js Behavior in Heroku
  • Node.js Behavior in Heroku

Node.js Behavior in Heroku

Last updated March 17, 2025

Table of Contents

  • Auto-Detection
  • Default Web Process Type
  • Build Behavior
  • Add-On Provisioning
  • Multi-Buildpack Behavior
  • Runtime Behavior
  • Additional Reading

This document describes the general behavior of Heroku as it relates to the recognition and execution of Node.js applications. For a more detailed explanation of how to deploy an application, see Getting Started on Heroku with Node.js or Getting Started on Heroku Fir with Node.js.

Auto-Detection

The Node.js buildpack is used when the application has a package.json file in the root directory. For Cedar-generation apps, the Heroku classic Node.js buildpack is used, while in Fir-generation apps, the Heroku Node.js Cloud Native Buildpack is used.

Default Web Process Type

First, Heroku looks for a Procfile specifying your process types.

If no Procfile is present in the root directory of your app during the build process but there is a start script in your app’s package.json then that will be used as the default web process. For example:

"scripts": {
  "start": "node server.js"
}

If you only want to run non-web processes in your app’s formation, explicitly scale web down and the other process types up. For example:

$ heroku scale web=0 worker=1

Build Behavior

Heroku’s Node.js buildpacks have different build behavior depending on whether an app uses classic or Cloud Native Buildpacks (CNB). See the following articles to learn about Node.js builds and how to customize them:

  • Node.js Classic Buildpack Builds
  • Node.js Cloud Native Buildpack Builds

Add-On Provisioning

No add-ons are provisioned by default. If you need a database for your app, add one explicitly.

$ heroku addons:create heroku-postgresql --app example-app

Multi-Buildpack Behavior

When using the Node.js buildpack with other buildpacks, it automatically exports the node binary as well the binaries for the package manager used (npm, pnpm, or yarn) onto the PATH for subsequent buildpacks to consume. The classic buildpack will also add node_modules/.bin onto the PATH.

Runtime Behavior

The buildpack exports the node binary as well the binaries for the package manager used (npm, pnpm, or yarn) onto the PATH at runtime so that you can execute with heroku run or use them directly in a Procfile. The classic buildpack will also add node_modules/.bin onto the PATH.

$ cat Procfile
web: npm start

The NODE_ENV environment variable is set to ‘production’ by default, but you can set it to any arbitrary string.

$ heroku config:set NODE_ENV=staging

Usually, you want NODE_ENV to be ‘production.’ Several modules, including express, implicitly change their behavior based on NODE_ENV.

Additional Reading

  • Heroku Node.js Support Reference
  • Node.js Classic Buildpack Builds
  • Node.js Cloud Native Buildpack Builds

Keep reading

  • Node.js Behavior in Heroku

Feedback

Log in to submit feedback.

Node.js Cloud Native Buildpack Builds Node.js Classic Buildpack Builds

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices