Node / NPM / Yarn

Installing deepstream via NPM and and Node.js

Node.js

deepstream can also be installed as an NPM package and offers a Node.js API to interact with it programmatically.

This can be useful to build custom authentication or permissioning logic. You can view the full Node.js API here.

Install the server via npm

npm install @deepstream/server

Create a js file, e.g. start.js with the following content

const { Deepstream } = require('@deepstream/server')

/*
The server can take
1) a configuration file path
2) null to explicitly use defaults to be overriden by server.set()
3) left empty to load the base configuration from the config file located within the conf directory.
4) pass some options, missing options will be merged from the base configuration.
*/
const server = new Deepstream()

// start the server
server.start()

run the file with node

node start.js

Starting deepstream via node

Using the deepstream client in Node.js

The deepstream javascript client can be installed via NPM and used in Node.js.

npm install @deepstream/client
const { DeepstreamClient } = require('@deepstream/client')
const client = new DeepstreamClient('localhost:6020')
client.login()