Exploring the Project

Get started

The repository, neo4j-graphacademy/app-nodejs, has been created for this course. It contains any starter code and resources you need.

You can use a GitHub codespace as an online IDE and workspace for this course. It will automatically clone the course repository and set up your environment.

Open in GitHub Codespace

GitHub Codespaces

You will need to login with a GitHub account. The GitHub Codespaces free monthly usage will cover the duration of this course.

Develop on your local machine

You will need NodeJS installed and the ability to install packages using npm.

Clone the github.com/neo4j-graphacademy/app-nodejs repository:

bash
git clone https://github.com/neo4j-graphacademy/app-nodejs

Install the required packages using npm:

bash
npm install

You do not need to create a Neo4j database as you will use the provided sandbox instance.

Setup the environment

Create a copy of the .env.example file and name it .env. Fill in the required values.

Create a .env file
APP_PORT=3000

NEO4J_URI=
NEO4J_USERNAME=
NEO4J_PASSWORD=

JWT_SECRET=secret
SALT_ROUNDS=10

Update the Neo4j sandbox connection details:

NEO4J_URI

bolt://{sandbox-ip}:{sandbox-boltPort}

NEO4J_USERNAME

{sandbox-username}

NEO4J_PASSWORD

{sandbox-password}

To run the application, open a terminal and run the following command:

bash
npm run dev

Explore the Repository

Here are some of the important directories in the project:

  • .env - This file holds environment variables for the server and is parsed by the dotenv library.

  • example/ - Example code for driver instantiation.

  • src/ - The application code:

    • middleware/ - Some custom middleware functions that are used by Express including generic error handling.

    • passport/ - Logic required for user authentication.

    • routes/ - Route handlers that are registered on the server. You shouldn’t need to edit these files.

    • services/ - Services that you will need to update to interact with Neo4j.

  • test/ - Test files that will you will need to run in order to pass the test. You will run these using the npm run test or yarn run test command.

  • public/ - Minified build files for the SPA. Do not edit these files.

Your Sandbox Instance

As part of this course, a Neo4j Sandbox instance has been created for you with the recommendations dataset. This dataset contains all of the details required to populate the Neoflix website.

What is Neo4j Sandbox?

Neo4j Sandbox is a free service that allows you to create pre-populated Neo4j instances completely free of charge. Neo4j Sandbox is the perfect environment for experimenting with Neo4j.

You can log into Neo4j Sandbox and create a database with a number of pre-populated datasets by visiting sandbox.neo4j.com.

Extending Your Sandbox Instance

By default, a Neo4j sandbox instance exists for 3 days. You can extend it for another 7 days by going to the sandbox site and extending it in the details (right-most down arrow) for the recommendations sandbox.

How to extend your Neo4j Sandbox instance

Accessing Your Sandbox Credentials

Your sandbox credentials can be accessed within the project through the process.env variable.

js
Accessing Environment Variables
const {
  NEO4J_URI,
  NEO4J_USERNAME,
  NEO4J_PASSWORD,
} = process.env

Done!

Once you are ready, click the button below to complete this lesson.

Lesson Summary

You now have a project setup and running with dummy data, and you have added your sandbox configuration details to the environment variables. You should now be ready to go.

In the next module, you will learn about the Neo4j en Driver.

Chatbot

How can I help you today?