Language Guides This section of guides and tutorials is designed to provide detailed examples and steps of how to integrate Neo4j with your preferred programming language. In this section, we provide an introduction for getting the initial system setup complete… Read more →
This section of guides and tutorials is designed to provide detailed examples and steps of how to integrate Neo4j with your preferred programming language. In this section, we provide an introduction for getting the initial system setup complete (regardless of language) and an overview of the consistent movie example application to use for several languages and Neo4j drivers.
How to connect to Neo4j?
To build an application, you want to connect to Neo4j from your technology stack. This is very easy!
The binary Bolt Protocol
Starting with Neo4j 3.0, we support a binary protocol called Bolt. It is based on the PackStream serialization and supports protocol versioning, authentication and TLS via certificates. Bolt is faster than other protocols such as HTTP and REST because it uses binary instead of text transfer (JSON or XML), and it also allows a connection to remain open, removing the multi-step handshake protocol for every request.
The binary protocol is enabled in Neo4j by default, so you can use any language driver that supports it.
For a detailed overview of the official drivers, see the Neo4j Driver Manual
And for more details on the protocol implementation, see the implementers documentation.
All Neo4j Drivers
To get started with your stack now, choose your preferred programming language from the list below and follow along. Happy creating!
Example Project Description
To demonstrate connection to and usage of Neo4j in different programming languages, we’ve created a consistent example application. It is a simple, one-page webapp, that uses Neo4j’s movie demo database (movie, actor, director) as the data set. The same front-end web page consumes 3 REST endpoints provided by a backend implemented with the different programming languages and drivers.
The image below shows the 3 REST end points that can be queried and the information it can return. * movie search by title * single movie listing * graph visualization of the domain
The foundation for the project is built upon the domain model below. A person node participates (whether through ACTED_IN or DIRECTED_IN relationships) in a movie node. Various Cypher queries can be run to find nodes, relationships, or movies which the user is interested in.
The source code for all of the different language examples is available on GitHub in individual repositories that can be cloned and directly used as starting points. Just click the link, search repositories for “movies”, and choose the repo for your programming language to get started building your application with Neo4j!
Using the HTTP API
If you want to access Neo4j programmatically, you can also use the HTTP-API, which allow you to:
- POST one or more Cypher statements with parameters (multiple per request to the server)
- Keep transactions open over multiple requests
- Choose different result formats
- Execute management operations or introspect the database
Let’s look at one of the underlying remote API endpoints that Neo4j offers to execute queries. These APIs can be then used directly via a HTTP library or a driver for your language.
A simple HTTP Cypher request, executable in the Neo4j Browser would look like this:
Some of the language drivers use the HTTP API under the hood, but make them available in a more convenient way.