If Javascript is your language of choice, the most popular drivers for Neo4j are:

About connection parameters

We've used test credentials for all the following examples. Please replace them with your real connection parameters.

You'll find all the required information to connect to your database on our admin panel if you navigate to the Connection section. More on connecting to your database here

Neo4j Bolt driver for Javascript

The Neo4j Bolt driver for Javascript is officially supported by Neo4j and connects to the database using the new binary Bolt protocol (HTTP/HTTPS is not available).

Driver web page: http://neo4j.com/docs/api/javascript-driver/current/

Bolt protocol is only available in 3.0.0 or higher versions of Neo4j. You can check your Neo4j version if you navigate to the Overview page of your database.

Install neo4j-driver via npm:

$ npm install neo4j-driver

Connect to the Neo4j instance:

var neo4j = require('neo4j-driver').v1;

var driver = neo4j.driver("bolt://hobby-geefdaeefcom.dbs.graphenedb.com:24786", neo4j.auth.basic("v303", "GtGq5rldxu"));

You can test the connection by creating a dummy node:

var session = driver.session();
session
    .run("CREATE (n:Person {name:'Bob'}) RETURN n.name")
    .then(function(result) {
        result.records.forEach(function(record) {
            console.log(record)
        });

        session.close();
    })
    .catch(function(error) {
        console.log(error);
    });

node-neo4j

node-neo4j is a Neo4j community driver maintained by the developers at FiftyThree, the makers of the popular iOS app, Paper.

Please note:

This driver only supports REST endpoints.

There are two versions of this package available. Please read on to select the right version of the package for your database.

node-neo4j v1

If your database is on Neo4j 1.x, you'll need to use node-neo4j v1. This version only supports Neo4j 1.5 through 2.1. You can read more about this driver version here: https://github.com/thingdom/node-neo4j/tree/v1

node-neo4j v2

node-neo4j v2 is the latest version (still in Release Candidate status at the time of writing this guide). The following instructions and examples are for node-neo4j v2.

Driver v2 documentation page: https://github.com/thingdom/node-neo4j/tree/v2

Install node-neo4j via npm:

$ npm install neo4j --save

Connect to the Neo4j instance using the GrapheneDB connection settings:

var neo4j = require('neo4j');
var db = new neo4j.GraphDatabase("http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789");

Test the connection by creating a dummy node:

db.cypher({
    query: 'CREATE (n:Person {name: {personName}}) RETURN n',
    params: {
        personName: 'Bob'
    }
}, function(err, results){
    var result = results[0];
    if (err) {
        console.error('Error saving new node to database:', err);
    } else {
        console.log('Node saved to database with id:', result['n']['_id']);
    }
});

Seraph

Seraph is a Neo4j community driver. This driver is a thin and familiar layer between node and neo4j's REST API.

The authors are working on supporting Bolt, but for now there is no stable release that provides support for the new binary protocol.

Driver documentation page: https://github.com/brikteknologier/seraph

Install seraph via npm:

$ npm install seraph

Setting up the HTTP or HTTPS connection:

var db = require("seraph")({
  server: "http://hobby-geefdaeefcom.dbs.graphenedb.com:24789",
  user: "v303",
  pass: "GtGq5rldxu"
});

Test the connection by creating and deleting a dummy node:

var cypherQuery = "CREATE (n:Person {name: {personName}}) RETURN n";
db.query(cypherQuery, {name: "Bob"}, function(err, results) {
  var result = results[0];
  if (err) {
      console.error('Error saving new node to database:', err);
  } else {
      console.log('Node saved to database with id:', result.id);
  }
});

Neo4j-fiber

Neo4j-fiber is a Neo4j community driver. This driver heavily depends on Fibers, so you’re required to wrap all code into Fiber.

Please note

Bolt protocol was not supported by this driver.

Driver documentation page: https://www.npmjs.com/package/neo4j-fiber
Demo application: https://github.com/VeliovGroup/neo4j-demo

Install neo4j-fiber via npm:

npm install --save neo4j-fiber

Setting up the HTTP or HTTPS connection:

var Fiber = require('fibers');
var Neo4jDB = requre('neo4j-fiber').Neo4jDB;

Fiber(function(){
  const db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');
}).run();

Test the connection by creating a dummy node:

var node = db.nodes({name: 'Bob'}).label(['Person']);

console.log(node.get());
// {
//   n: {
//     name: "Bob",
//     id: 1
//   }
// }

Meteor.js

Neo4j-fiber is fully compatible with Meteor.js. You can install neo4j-fiber via npm:

meteor npm install --save neo4j-fiber

Setting up the HTTP or HTTPS connection:

var Neo4jDB = require('neo4j-fiber').Neo4jDB;

var db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');

Meteor: Neo4jdriver

Neo4jdriver is a Neo4j community driver. This driver is designed to be used on the server side of a Meteor application.

Please note

This driver will be deprecated soon in favour of npm package. The driver's author recommends to use neo4j-fiber, as it's fully compatible with Meteor.

Driver documentation page: https://atmospherejs.com/ostrio/neo4jdriver

Install neo4jdriver to Meteor:

meteor add ostrio:neo4jdriver

Setting up the HTTP or HTTPS connection:

import { Neo4jDB } from 'meteor/ostrio:neo4jdriver';

const db = new Neo4jDB('http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789');

See the Neo4j-fiber section to find an example.

Node.js