You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nicolas Dextraze 732b691e40 Move typescript dependencies back to dev 3 years ago
.idea Make Ssl tests opt-in 4 years ago
samples Removed some console 3 years ago
src Fix missing warn in Loggers 3 years ago
test Make Ssl tests opt-in 4 years ago
tools Fix issue with fake-server 4 years ago
.gitignore 18 - Changing all hostname to host, fixing some async issues in tests 5 years ago
LICENSE Initial commit 6 years ago Update documentation for strict-event-emitter-types dependency 3 years ago
Vagrantfile 18 - Changing all hostname to host, fixing some async issues in tests 5 years ago
index.d.ts Make type definition of expectedVersion match implementation 3 years ago
index.js Rename project to node-eventstore-client 5 years ago
package-lock.json Fix appendToStream with expectedVersion any and same event not working due to protobufjs bug 3 years ago
package.json Move typescript dependencies back to dev 3 years ago
webpack.config.js using webpack to generate a distribution version in ./lib/dist.js 6 years ago
yarn.lock Published version 0.2.10 and moved types dependencies to devDependencies 3 years ago


A port of the EventStore .Net ClientAPI to Node.js


Missing features:

  • Set system settings

Areas to improve

  • Errors
    • Use codes or types to differentiate between errors
  • Performance
    • Performance hasn't been tested yet
  • Tests
    • Can always do with more tests

Getting started

Install using npm install node-eventstore-client


Install and run an Eventstore on localhost


Note: If you are using a version of EventStore prior to 3.9.4, you need to use version 0.1.x of this package npm install node-eventstore-client@^0.1.

API Documentation


The offline documentation can be found in the module folder ./node_modules/node-eventstore-client/docs.


The online documentation can be found at

Example: Storing an event

Save to app.js:

var esClient = require('node-eventstore-client');
var uuid = require('uuid');

var streamName = "testStream";
  Connecting to a single node using "tcp://localhost:1113"
  - to connect to a cluster via dns discovery use "discover://"
  - to connect to a cluster via gossip seeds use 
    new esClient.GossipSeed({host: '', port: 2113}), 
    new esClient.GossipSeed({host: '', port: 2113}), 
    new esClient.GossipSeed({host: '', port: 2113})
var connSettings = {};  // Use defaults
var esConnection = esClient.createConnection(connSettings, "tcp://localhost:1113");
esConnection.once('connected', function (tcpEndPoint) {
    console.log('Connected to eventstore at ' + + ":" + tcpEndPoint.port);

var eventId = uuid.v4();
var eventData = {
    a : Math.random(), 
    b: uuid.v4()
var event = esClient.createJsonEventData(eventId, eventData, null, 'testEvent');
esConnection.appendToStream(streamName, esClient.expectedVersion.any, event)
    .then(function(result) {
        console.log("Stored event:", eventId);
        console.log("Look for it at: http://localhost:2113/web/index.html#/streams/testStream");
    .catch(function(err) {


npm install uuid
npm install node-eventstore-client
node app.js

Example: Subscribing to events

cd samples

To subscribe to all events from now on (includes example of a filter which ignores events which we aren't interested in):

node subscribe-all-events.js

To catch up on all events ever and subscribe to all new ones from now on:

node subscribe-catchup-all-events.js

To generate a test event, open a separate console and run:

node store-event.js

Running the tests

To run the tests it is recommended that you use an in-memory instance of the eventstore so you don't pollute your dev instance.

EventStore.ClusterNode.exe --run-projections=all --memdb –certificate-file=yourcert.pfx
./ --run-projections=all --memdb –certificate-file=yourcert.p12

For SSL setup see:

To execute the tests suites simply run

npm test

Porting .Net Task to Node.js

Any async commands returns a Promise object in replacement of .Net Task.


Ported code is released under the MIT license, see LICENSE.

Original code is released under the EventStore license and can be found at