Using Variables in a Heroku Procfile

Image for post
Image for post

A Heroku Procfile has access to the config variables set for an app. This can be used to make the Procfile dynamic.

In Heroku, an app’s config variables can be set in two ways.

1.) Using the web interface to navigate to the app’s settings tab:

Image for post
Image for post

2.) With the following command:

heroku config:set CONFIG_VAR_NAME=var_value -a appName

These variables can now be access by prefixing the variable name with $. This can be useful in a few ways. For instance, let’s say that we want to dynamically set the heap size of a web server dynamically. We could first create a HEAP_SIZE configuration variable and then access it in the Procfile.

web: node --max_old_space_size=$HEAP_SIZE server.js

To learn more about a Procfile, visit

That’s it!

By default, Node sets a memory/heap size limit that is under 2 GB. This default can be changed by passing in a value in megabytes (MB) when starting a Node server using the following option:


Thus, the command below will start a server with a heap size of up to 4 GB.

node --max_old_space_size=4000 scriptThatStartsServer.js

You can take advantage of one of the best features of TypeScript — smart code completion (IntelliSense) for modules and packages while using Visual Studio Code (VSC) — without needing to use it in a project.

Image for post
Image for post
Visual Studio Code IntelliSense for AngularJS Using TypeScript Definitions

To add this TypeScript feature to a JavaScript project, you will need to install TypeScript globally and the TypeScript definition files (extension .d.ts) for the modules and packages used in your project. We will be using the Typings package to manage TypeScript definition files.

1. Install TypeScript and Typings

a. Install TypeScript globally

$ npm install -g typescript

b. Install Typings globally

$ npm install -g typings

2. Setting Up Project

Note: run the command below from the root of your project. …


Carlos Raiti Mendoza

Software Developer. Focused. Determined. Unstoppable.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store