Neo4j from JavaScript

Hi All,

I am a student trying to build a web application using neo4j as the back end. I would like to connect my front end, in which I am using HTML and javaScript to connect to neo4j, but I'm having trouble understanding and following the instructions given here: successfully.

I am using mac and also having trouble installing node.js and npm via my terminal.

I have no prior experience in this, I would be grateful if you could help me.

One way could be just Neo4j REST APIs using jquery etc from your UI..
URL: http://localhost:7474/db/data/transaction/commit
Method: post
Add Authorization header with Basic token

        "statement": "<query as string>"
      "parameters" : {
      "country" : "es"
    url: 'http://localhost:7474/db/data/transaction/commit',
    type: 'post',
    data: body,
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Basic your_basic_auth_token'
    dataType: 'json',
    success: function (data) {;

Use this option only for learning as your credential could be exposed


How can get this value, basic token? 'Authorization': 'Basic your_basic_auth_token'

I already look at neo4j desktop, but cant find it.

How can get this value, basic token? 'Authorization': 'Basic your_basic_auth_token'

You can obtain that token by authenticating via basic auth (username and password).
In Neo4J's driver this is accomplished in JS like this:

const neo4j = require('neo4j-driver')
neo4j.auth.basic(user, password)

You can find the documentation here:

Regarding npm / nodejs installation:
You can find install binaries directly on

As a suggestion I would rely on using a framework like express to create a basic API for the frontend based on your requirements.

You can then call your own http(s) routes and leave Neo4J and authentication in the backend.