Dokku uses an open source Node.js buildpack to compile and run your application. Follow these steps to configure and deploy your app.

Preparing Your Application for Deployment

1. Your project root directory should include a package.json so that the Dokku build process recognizes that your code base is a Node.js application. At the minimum, you should specify the desired version of Node.js to ensure production matches your development environment. We recommend that you use an up-to-date LTS version, as these are stable and patched for security flaws.

  "name": "myapp",
  "description": "a really cool app",
  "engines": {
    "node": "6.12.3"

If your app has a build step that you'd like to run when you deploy, you can include a postinstall script:

"scripts": {
  "postinstall": "bower install && grunt build"

2. Define the startup command for your application in either a Procfile or your package.json.

Procfile example:

web: node server.js


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

Note: server.js should be set to the actual entry point of your app.

Define an App on the Server

Connect to the server and create your app(s):

dokku apps:create my-app-name

Configure Environment Variables

In Dokku, production-specific configuration settings are stored in environment variables. Environment variables are created using the Dokku command line interface:

dokku config:set my-app-name MONGODB_URI="mongodb://database-user:database-password@server-address/database-name?ssl=true"

Your application code can retrieve the settings from process.env:

mongodb.MongoClient.connect(process.env.MONGODB_URI, function (err, database) {...

Note: Database connection examples are shown in the Dokku Getting Started Guide, under "Database Configuration."

Deploy your App

See Deploying via Git

Using Docker Natively

If you prefer to use your own Dockerfile instead of the Node.js buildpack, please refer to the official Dokku Dockerfile deployment instructions.

Frequently Asked Questions

How do I switch to a different version of the Node.js buildpack?

Periodically, we upgrade Dokku to the latest stable version, which also includes updated references to various buildpacks. However, if you would like to use a newer buildpack version that is not yet present on your server, or a different one altogether, you can run the following command:

dokku config:set my-app-name BUILDPACK_URL=

Notice the last part (#v91) which maps to a specific GitHub release.

How do I prevent an exception from crashing my app?

Check out these resources for guidance:

Reference Application

The following Node.js app has been tested on the Healthcare Blocks platform:

Additional Documentation

More help topics can be found in the Dokku Getting Started guide.