Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.


To create a new project with Node.js:

  • Log in to the Divio Cloud Control Panel. 
  • Select Add new Project, with the following options:
  • Creation: New
  • Python: No Python
  • Boilerplate: Node.js or (to have React.js preinstalled) React.js

Local Development

Setting up a project locally is very easy and fast, the only commands you need to run a project are:

  • divio project setup PROJECT_NAME 
  • divio project run PROJECT_NAME 

You can install the Divio CLI by downloading the Divio App.


For further documentation on Node.js please consult their official documentation.


Divio Cloud provides a Postgres database for each project. You can connect to this by installing the "pg" package via npm install pg --save . An example configuration would look like:

const pg = require('pg');
const config = {
    user: 'postgres',
    database: 'db',
    password: '',
    host: 'db',
    port: 5432
const pool = new pg.Pool(config);

You can also get the connection information from the DATABASE_URL  environment variable which outputs :


Sometimes it takes some time for the database to be available locally. For this add the following to your docker-compose.yml web service section:

command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; npm start'
  - db

For further documentation please consult the "Pooling example" found in node-postgres.

Did this answer your question?