DEV Community

loading...
Cover image for Graphs on Tap
Neo4j, Inc.

Graphs on Tap

Andreas Kollegger
Updated on ・3 min read

Neo4j Relate delivers graphs on tap. From the CLI, from your app, or from a local server, you can provision Neo4j databases whenever you'd like to enjoy the clean, refreshing goodness of graphs.

Extracted from Neo4j Desktop

The best frameworks are in my opinion extracted, not envisioned.
-- David Heinemeier Hansson

Neo4j Desktop is a native application which packages up everything you need for working with the Neo4j DBMS.

Internally, there is a GraphQL API through which tools may discover available databases, provision new ones and negotiate authentication.

Neo4j Desktop is extensible. New tools can be added, and you can write your own. But it feels like a walled garden. Peering over the hedge, wouldn't it be nice to easily manage Neo4j from the command line, or from VS Code, or even from within your app?

Neo4j Relate extracts the core operational library of Neo4j Desktop then packages that into a CLI tool, a web server, or a generic Electron app. Let's take the CLI for a spin.

CLI, App, Server to Neo4j Relate

Neo4j at your command

Now witness the firepower of this fully armed and operational battle station CLI
-- The Emperor

The @relate/cli package installs the relate command line tool. There is a PR which will make the CLI available without requiring node.js.

For now, try:

npm install -g @relate/cli
Enter fullscreen mode Exit fullscreen mode

Set up a provisioning environment:

relate env:init --name=graphs-on-tap --type=LOCAL
Enter fullscreen mode Exit fullscreen mode

Accept the default settings when prompted. You'll need to provide this semi-secret access code r31473:

Enter the access code you received from applying at https://neo4j.relate.by/invite:r31473
✔ Do you need to enable authentication? (y/N) · false
✔ Do you need to restrict access to the GraphQL API methods? (y/N) · false
✔ Are HTTP consumers required to have an API key? (y/N) · false
Creating environment... done
Enter fullscreen mode Exit fullscreen mode

The authentication mentioned above is for the GraphQL API, which we'll explore in a later post.

Now install a Neo4j DBMS named "hello" into the provisioning environment named "graphs-on-tap". If you drop 4.1.3 from the end, you can pick which version to install:

relate dbms:install -e graphs-on-tap --name hello 4.1.3
Enter fullscreen mode Exit fullscreen mode

Enter new passphrase: will set the password for the admin user named "neo4j":

✔ Enter new passphrase · 
DOWNLOAD PROGRESS [████████████████████████████████████████] 100%
extracting neo4j... done
[b92ada41] hello
Enter fullscreen mode Exit fullscreen mode

Finally, start the DBMS named "hello" within the "graphs-on-tap" environment:

relate dbms:start -e graphs-on-tap hello
Enter fullscreen mode Exit fullscreen mode

Neo4j DBMS should start up, then you'll be able to browse to http://localhost:7474 to use Neo4j Browser. Use the admin user named neo4j and the password you set above.

Convenient, right?

Try relate --help to see the other available commands and options. For instance, relate env:use to set the "current" environment, saving you a little typing.

Next steps

Neo4j Relate is in alpha, evolving quickly with more capabilities and integrations. Stay tuned and reach out to me with any ideas or questions.

In later posts, I'll explore:

  • e2e testing using relate to do setup & teardown
  • hosting Browser, Bloom and other tools without needing Neo4j Desktop
  • spinning up a server to provision DBMSes on demand
  • writing nest.js modules to use relate as an application server

Related...

Discussion (0)