Skip to main content

Set up Pulsar Node.js client

To set up Java client library in Pulsar, complete the following steps.

Step 1: Install Node.js client library

Install the pulsar-client library via npm:

npm install pulsar-client

For more information, see README.


This library only works in Node.js 10.x or later versions because it uses the node-addon-api module.

Step 2: Connect to Pulsar cluster

To connect to Pulsar using client libraries, you need to specify a Pulsar protocol URL.

You can assign Pulsar protocol URLs to specific clusters and use the pulsar scheme. The following is an example of localhost with the default port 6650:


If you have multiple brokers, separate IP:port by commas:


If you use mTLS authentication, add +ssl in the scheme: