Skip to content
devarentPublic

About

Run Neo4j 5 in Docker, load a small graph, and practice Cypher patterns, paths, and aggregations.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Arya Fatthurahman

Neo4j Lab

Run Neo4j 5 in Docker, load a small graph, and practice Cypher patterns, paths, and aggregations.

Database: Neo4j Category: Graph database Runs in Docker License: MIT compose-check

What this lab is

Neo4j stores relationships as first-class citizens, which makes multi-hop questions natural. This lab starts Neo4j with the Browser, loads a small social graph, and walks through Cypher MATCH, MERGE, variable-length paths, and shortestPath.

Quickstart

docker compose up -d
docker compose cp examples/01_seed.cypher neo4j:/tmp/01_seed.cypher
docker compose cp examples/02_queries.cypher neo4j:/tmp/02_queries.cypher
docker compose exec neo4j cypher-shell -u neo4j -p labpassword -f /tmp/01_seed.cypher
docker compose exec neo4j cypher-shell -u neo4j -p labpassword -f /tmp/02_queries.cypher
open http://localhost:7474

Connection details

Field Value
Browser http://localhost:7474
Bolt neo4j://localhost:7687
User neo4j
Password labpassword
cypher-shell docker compose exec neo4j cypher-shell -u neo4j -p labpassword

Examples

File What it shows
docker-compose.yml Engine, ports, and persistent volume.
.github/workflows/compose-check.yml Validates the Compose file on every push.
examples/01_seed.cypher A small graph of people, companies, and skills.
examples/02_queries.cypher Pattern matching, aggregation, and shortest paths.

Exercises

  1. Add a PROJECT relationship between people and projects, then query two-hop neighbors.
  2. Use MERGE to make the seed script idempotent.
  3. Create a full-text index on Person.name and query it.
  4. Profile a query with PROFILE and explain the number of db hits.

Notes and limits

  • The password labpassword is a local lab credential. Change it before exposing Bolt.
  • The Browser on port 7474 is the easiest way to explore the graph visually.
  • Cypher is case-sensitive for labels and relationship types in this lab's examples.
  • Data persists in the neo4j-data volume.

Run it from anywhere

This lab publishes its ports on 127.0.0.1 only. To use it from another country, do not open the database port to the internet. Pick one:

  • VPS + private tunnel: run the lab on a small Ubuntu VPS, keep the port closed, and connect through WireGuard or ssh -L.
  • Managed service: use a managed free tier for this engine and point the same examples at its connection string.
  • HTTP UI only: if the engine has a web UI, put it behind Caddy with TLS and basic auth.

The shared checklist, provider map, and commands are in REMOTE-ACCESS.md.

Cleanup

docker compose down -v

-v also removes the named volume, so the next start is a clean slate.

References


Part of the database-labs collection: 26 database engines, one index.

License

MIT (c) 2026 Arya Fatthurahman. See LICENSE.

About

Run Neo4j 5 in Docker, load a small graph, and practice Cypher patterns, paths, and aggregations.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors