Raised: $0
0% of monthly goal Help us cross the finish line!
Goal: $12,000
Raised: $0 Goal: $12,000
0% of monthly goal Help us cross the finish line!
Sponsor DDEV

If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.

ddev-neo4j

tests Add-on Registry Project is maintained

A DDEV add-on that provisions a Neo4j graph database service alongside your DDEV project. Designed to be zero-config for Drupal sites that consume Neo4j but useful for any DDEV project that needs a local graph database.

What you get

Install

ddev add-on get kevinquillen/ddev-neo4j
ddev restart

First boot takes ~30 seconds while Neo4j downloads and installs APOC and GDS into the plugins volume; subsequent boots are fast.

Open the Browser UI:

ddev launch :7475
# or visit https://<project>.ddev.site:7475 directly

In the Browser’s Connect form:

Field Value
Connect URL bolt+s://<project>.ddev.site:7687
Authentication Username / Password
Username neo4j
Password ddevpassword (override via .ddev/config.neo4j.yaml)

The cert is generated at install time with mkcert — the same tool DDEV uses for its own TLS — so it’s signed by the same root CA your browser already trusts. No certificate warning, no bolt+ssc:// workaround.

If mkcert wasn’t available at install time, the add-on falls back to an openssl self-signed cert; use bolt+ssc://<project>.ddev.site:7687 in that case (the Browser will prompt you to trust it once).

Connect from your project

From PHP (Drupal-ready)

If your project type is Drupal, the add-on writes web/sites/default/settings.ddev.neo4j.php and includes it from settings.php. It populates:

$settings['content_graph_neo4j'] = [
  'uri' => 'bolt://neo4j:7687',
  'username' => 'neo4j',
  'password' => getenv('DDEV_NEO4J_PASSWORD') ?: 'ddevpassword',
  'database' => getenv('DDEV_NEO4J_DATABASE') ?: 'neo4j',
];

Sites that need bespoke credentials can simply not include the file and define their own block.

From the CLI

ddev exec cypher-shell -a bolt://neo4j:7687 -u neo4j -p ddevpassword

Connection endpoints

Caller Endpoint
PHP / drush / web container bolt://neo4j:7687 (plaintext, in-network)
Host machine (Browser UI, Neo4j Desktop, local cypher-shell) bolt+s://<project>.ddev.site:7687
HTTP API (from web container) http://neo4j:7474

Neo4j is configured with server.bolt.tls_level=OPTIONAL, so the same port 7687 accepts both plaintext Bolt (for in-network clients) and TLS-wrapped Bolt (for the Browser UI and any host-side client).

Override the host-side Bolt port via DDEV_NEO4J_BOLT_HOST_PORT in .ddev/config.neo4j.yaml if 7687 collides with another project.

Configuration overrides

The add-on ships .ddev/config.neo4j.yaml for per-project tuning. Edit it and run ddev restart:

web_environment:
  - DDEV_NEO4J_PASSWORD=ddevpassword
  - DDEV_NEO4J_DATABASE=neo4j
  - DDEV_NEO4J_HEAP_INITIAL=512m
  - DDEV_NEO4J_HEAP_MAX=1G
  - DDEV_NEO4J_PAGECACHE=512m
  - NEO4J_DOCKER_IMAGE=neo4j:5-community
  - NEO4J_ACCEPT_LICENSE_AGREEMENT=no

To claim ownership of the file (so a future ddev add-on get won’t overwrite your edits), delete the #ddev-generated marker comment at the top.

Note: values that contain YAML flow indicators ([, ], {, }, ,) cannot live in config.neo4j.yaml — they get inlined as plain scalars into the rendered base compose file and break the merged-file YAML parse. To override the plugin list, edit NEO4J_PLUGINS directly in .ddev/docker-compose.neo4j.yaml.

Use Neo4j Enterprise (opt-in)

web_environment:
  - NEO4J_DOCKER_IMAGE=neo4j:5-enterprise
  - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes

You are responsible for complying with Neo4j’s commercial license.

Disable plugins

Edit the NEO4J_PLUGINS line in .ddev/docker-compose.neo4j.yaml and set it to []:

      - 'NEO4J_PLUGINS=[]'

Then run ddev restart.

Low-memory hosts

web_environment:
  - DDEV_NEO4J_HEAP_MAX=512m
  - DDEV_NEO4J_PAGECACHE=256m

Wipe the database

Three options, in order of severity:

# Drop all nodes/relationships, keep credentials and config.
ddev exec cypher-shell -a bolt://neo4j:7687 -u neo4j -p ddevpassword \
  'MATCH (n) DETACH DELETE n'

# Remove the data volume only.
ddev stop
docker volume rm "ddev-${DDEV_PROJECT:-$(basename $PWD)}-neo4j-data"
ddev start

# Remove the add-on entirely (wipes data, logs, plugin caches,
# Drupal settings include).
ddev add-on remove neo4j

Compatibility

Layer Tested Notes
DDEV CLI 1.24.10+ Required for x-ddev describe extensions
Neo4j 5.x community 5-enterprise supported as opt-in
Plugins APOC 5.x, GDS 2.x Pinned to Neo4j 5
Host OS macOS (Apple Silicon + Intel), Linux x86_64 Multi-arch image
Drupal 9, 10, 11 Settings injection is conditional on PROJECT_TYPE

Operational notes

Removing the add-on

ddev add-on remove neo4j

This removes:

Testing

brew install bats-core bats-assert bats-file bats-support
bats ./tests/test.bats

CI runs the same suite via ddev/github-action-add-on-test on every PR, every push to main, and weekly on a cron schedule.

License

Apache 2.0. See LICENSE.

Neo4j community edition is GPL v3; Neo4j enterprise edition is commercial. APOC is Apache 2.0; Graph Data Science community edition is GPL v3. You are responsible for compliance with their respective licenses when running the add-on.

If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.