Deploying a GRANDstack application to AuraDB
In this page, we will learn how to build and deploy a GRANDstack application with Neo4j AuraDB.
We should have created and started a Neo4j AuraDB database instance. If we have not already, we can follow the instructions in the getting started guide to step through the process. We should also be familiar with the GRANDstack.
Intermediate
Now that we’ve created our Neo4j AuraDB database, we’re going to learn how to deploy a GRANDstack application that queries data stored in that database.
The Football Transfers Graph
We’re going to deploy an application built on top of a graph containing football transfers scraped from transfermarkt.co.uk. See Football Transfers Graph to learn more about the dataset.
Connect to Neo4j AuraDB with Neo4j Desktop
The first thing we need to do, in Neo4j Desktop, is create a remote connection to our AuraDB database. See the Connect to Neo4j AuraDB with Neo4j Desktop guide for step by step instructions explaining how to do this.
Neo4j Cloud Tool
We’re going to use the Neo4j Cloud Tool to import our data, so let’s see how to set up that application.
We can install that directly via this link, or if that doesn’t work we can paste the following URL into the Graph App URL
field on the Graph Applications menu:
https://neo.jfrog.io/neo/api/npm/npm/neo4j-cloud-ui
Once we do that we’ll see the following prompt:
We can now launch the Neo4j Cloud Tool, which will take us to the following screen:
Importing the dataset
We’re going to use the Neo4j Cloud tool to import this dataset.
Click on the Check existing database
button.
This will check whether our AuraDB database contains existing data.
Assuming an empty database, we’ll see the following screen:
Clicking on the Next
button will take us to the following screen:
From here we can import databases or a dump file. We’ll be using the latter functionality to import a dump containing the football transfers database.
The dump file can be downloaded from aura-datasets.s3.amazonaws.com/football-transfers.dump.
Once we’ve downloaded that file we’ll select it as the dump file to import.
After that we’ll click on the Import Dump file
button.
This will take a few minutes to run, but eventually we’ll see output similar to the following:
Click on the View data in Neo4j Browser
button to see what we’ve imported.
The diagram below shows a sample of the imported graph:
Our Application
Let’s have a look at the GRANDstack application that we’re going to deploy. The application is a football transfers one built on top of the graph that we imported in the previous step. See Football Transfers Graph App with the GRANDstack Starter Kit to learn more about the application itself.
The following command will clone the football transfers project locally:
git clone git@github.com:mneedham/football-transfers-app.git
cd football-transfers-app
The application has two parts:
-
API - this code powers a GraphQL API on top of our Neo4j database, and lives in the
api
directory. -
UI - the
ui
directory contains a React application that renders data extracted from the GraphQL API.
The diagram below shows the architecture of our application and how it interacts with Neo4j:
Now CLI
We’re going to deploy the application using ZEIT, a cloud platform for websites and serverless APIS.
First we’ll need to create an account on that platform via zeit.co/signup.
Once we’ve done that we can install the Now CLI on our machine using instructions from zeit.co/download:
npm i -g now
Now let’s login to ZEIT using the Now CLI tool:
now login
If we run that, we’ll see the following output:
> Enter your email: xxx@xxx.com
> We sent an email to xxx. Please follow the steps provided
inside it and make sure the security code matches xxx.
Once we’ve entered our credentials we’ll receive an email which will contain a link that we need to click to verify that we want to login. The console will then be updated with the following message:
✔ Email confirmed
> Congratulations! You are now logged in. In order to deploy something, run `now`.
Define credentials
Now we’re ready to tell ZEIT about our database credentials. We’ll need to provide the following details:
-
Bolt URL
-
Username
-
Password
If we open our Neo4j AuraDB Console Dashboard, we’ll see a list of our databases.
We’ll need to use the Bolt URL, so let’s copy that onto our clipboard:
The default username is neo4j
and the default password is generated on database creation.
For the database described above we’d have the following credentials:
-
Bolt URL -
bolt+routing://648d934e.databases.neo4j.io
-
Username -
neo4j
-
Password -
9UvUS6UnVAnr7_ziNaKg—e7ekd-5x4AEL7yseEFsl8
We can run the following commands to add these credentials as ZEIT secrets.
Don’t forget to change the credentials below to match those of your own AuraDB database. Copy and pasting the credentials below won’t work as that database has long since been destroyed! |
now secret add NEO4J_URI bolt+routing://648d934e.databases.neo4j.io
now secret add NEO4J_USER neo4j
now secret add NEO4J_PASSWORD 9UvUS6UnVAnr7_ziNaKg--e7ekd-5x4AEL7yseEFsl8
Deploying GRANDstack application
We’re now ready to deploy our application, which we can do by executing the following command:
now
Running this command will result in the following output:
> Deploying ~/projects/football-transfers-app under mneedham
> Using project grand-stack-starter
> Synced 21 files [652ms]
> Upload [====================] 99% 0.0s> NOTE: This is the first deployment in the grand-stack-starter project. It will be promoted to production.
> NOTE: To deploy to production in the future, run `now --prod`.
> https://grand-stack-starter-ou2l4008p.now.sh [4s]
> Ready! Deployment complete [2m]
- https://grand-stack-starter-seven-wheat.now.sh
- https://grand-stack-starter.mneedham.now.sh [in clipboard]
We can then navigate to the provided URL, which in this case is https://grand-stack-starter-seven-wheat.now.sh/
.
Once this page has loaded, we’ll see a list of the top transfers:
We can navigate to other screens via the left menu:
My favourite one is Country Money Flow
, so let’s have a look at that:
We’ve now deployed our first GRANDstack application. If any of the steps don’t make sense or didn’t work, please let us know in the GraphQL and GRANDstack topic on the community site.
Help and Questions
Helpful guides and support are available on the AuraDB support pages.
You can also ask questions and connect with other people launching Neo4j AuraDB at the cloud topic on the community site.
Was this page helpful?