Skip to content
Back to catalog
Neo4j

Query Neo4j AuraDB

Store and query connected data in a Neo4j AuraDB graph database from an Appwrite Function

Neo4j is a graph database. It stores data as nodes connected by relationships and queries them with the Cypher language, which makes questions about connections, such as recommendations, fraud rings, or supply chains, fast to answer. AuraDB is Neo4j's fully managed cloud service.

How does the integration work?

The Query Neo4j AuraDB function template shows how to work with a graph database from Appwrite Functions. Each GET request to the function:

  1. Creates a Warehouse node with a random location and capacity.
  2. Links it to a Category node, such as electronics or furniture, with a STORES relationship, creating the category only if it doesn't exist yet.
  3. Returns up to 100 warehouse and category pairs as JSON.

The function keeps its driver connection between executions, so warm requests skip the connection setup. Use it as a starting point for your own Cypher queries.

How to implement

To implement the Neo4j AuraDB integration, there are several steps you must complete:

Step 1: Create an AuraDB instance

Sign in to the Neo4j Aura console and create an AuraDB instance. When Aura shows the instance's credentials, download or copy them, because the password isn't shown again. The credentials include:

ValueExample
Connection URIneo4j+s://<INSTANCE_ID>.databases.neo4j.io
Usernameneo4j
PasswordThe generated password

Wait until the instance is running before you continue.

Step 2: Create the Appwrite Function

For this step, you must create an account on Appwrite Cloud or self-host Appwrite if you haven't already. If you self-host Appwrite, enable a Node.js runtime in _APP_FUNCTIONS_RUNTIMES and follow the Functions configuration guide so function domains work.

In the Appwrite Console, go to Functions, open the Templates tab, search for Query Neo4j AuraDB, and click Create from template. Fill in the Template variables:

VariableValue
NEO4J_URIThe connection URI
NEO4J_USERThe username
NEO4J_PASSWORDThe password

Choose Connect your repository to clone the template into a Git repository where you can write your own queries, or Connect later to deploy it right away. Then click Create and deploy.

Step 3: Test the function

Copy the function's domain from the Domains tab and send a request:

Bash
curl https://<FUNCTION_DOMAIN>

The response contains the query's records, each with a Warehouse node and its Category node. Every request adds another warehouse, so the list grows as you call the function. Requests with other methods return 404.

To see the graph, open your instance in the Aura console and run:

Plain text
MATCH (w:Warehouse)-[:STORES]->(c:Category) RETURN w, c

The template allows anyone to execute the function, so anyone who finds its domain can add warehouses to your database. Before you query your own data, replace Any in the function's execute access with narrower roles, such as Users, and call the function with an Appwrite SDK instead of its domain.

Read more about Neo4j and Appwrite Functions

If you would like to learn more about Neo4j and Appwrite Functions, we have some resources that you should visit:

Technology Partner Program

Building on Appwrite?

Teams and developers who ship integrations, tools, or services on Appwrite can join our partner program for verified catalog placement, co-marketing, training, and engineering support.