Helion Stackato has a built in Node framework with multiple versions of the Node.js runtime. NPM is used to install Node packages automatically.


Your application should list dependencies in a standard, top-level package.json file (specs). Helion Stackato automatically installs packages listed in the "dependencies" section before starting the server.

Alternatively, you can call npm directly using hooks: in the manifest.yml file (for example, see the RailwayJS Helion Stackato sample application).

For NPM packages which include callable scripts or binaries, executable components are automatically added to the container's $PATH, so a global installation (for example, npm install -g) is not required.

Host and Port Environment Variables

Deploying Node applications to Helion Stackato requires changing some application settings to use instance-specific values. These values are provided on Helion Stackato with environment variables. For example, the application is not allowed to arbitrarily choose which port it runs on. It must use the one assigned by Helion Stackato with the PORT variable. To access this in a node application:


Likewise, the host IP address is exposed by VCAP_APP_HOST:


To make the application usable in both local and Helion Stackato deployments, use structures such as:

var port = process.env.PORT || 1337;
var host = process.env.VCAP_APP_HOST || "";

Using Data Services

Data services need to be configured with values from VCAP_SERVICES, STACKATO_SERVICES, DATABASE_URL, or a database-specific environment variable (see also Using Configured Database Services).

If the database module you use supports URL-formatted connection strings, using the DATABASE_URL or database-specific URL variable (REDIS_URL, MONGODB_URL, and so on) is often the simplest option.

Use the variable in your code to connect your application to the database. For example:

console.log("attempting to connect to mongodb");
} else {
  mongoose.connect("", "myappdb", 27017);

Alternatively, VCAP_SERVICES is a JSON object containing information about all the data service bound to the application. A typical VCAP_SERVICES variable containing a single MongoDB service might look like this:

  "mongodb": [
      "name": "todos",
      "label": "mongodb-2.4",
      "plan": "free",
      "tags": [
      "credentials": {
        "hostname": "",
        "host": "",
        "port": 25001,
        "username": "4ce459bf-7a15-4c40-ac28-81adbdeba902",
        "password": "00a42612-9751-4d63-a758-186429d4903f",
        "name": "b89e2bc0-cae7-482c-8a47-8c816c67c62e",
        "db": "db"

To use this information in your application code, use something similar to this block from the node-backbone-mongo demo application:

  var services = JSON.parse(process.env.VCAP_SERVICES);
  var dbcreds = services['mongodb'][0].credentials;

  mongoose.connect(, dbcreds.db, dbcreds.port, {user: dbcreds.username, pass: dbcreds.password});
} else {
  mongoose.connect("", "myappdb", 27017);

This is the typical pattern used for all databases exposed by VCAP_SERVICES.