Docker Compose for Neo4j

Welcome! I'm Param, and in this workshop we are going to build a Graph RAG service end to end. You will extract entities and relationships from unstructured text, store them in Neo4j, let an LLM write Cypher against them, and compare the whole thing against a vector baseline. By the end, multi-hop questions that used to break your retriever will have a real answer.

Vector RAG is excellent at finding passages that sound like your question. It is terrible at chaining facts. "Who did Alice report to before she joined Acme?" is not a similarity problem, it is a traversal problem. A knowledge graph stores relationships as first-class citizens, which is exactly what those questions need.

terminal
bash
# Clone the workshop repository
git clone https://github.com/learnwithparam/graph-rag-neo4j.git
cd graph-rag-neo4j

# One command to set up, start Neo4j, and run the API
make dev

This clones the repo, creates the .env file, installs dependencies with uv, starts the Neo4j container, and boots the FastAPI server on port 8000.

docker-compose.yml
yaml
services:
  neo4j:
    image: neo4j:5.20-community
    container_name: graph-rag-neo4j-db
    ports:
      - '7474:7474'
      - '7687:7687'
    environment:
      - NEO4J_AUTH=neo4j/learnwithparam
      - NEO4J_PLUGINS=['apoc']
    volumes:
      - neo4j_data:/data
    healthcheck:
      test: ['CMD-SHELL', 'wget -q -O /dev/null http://localhost:7474 || exit 1']
      interval: 10s
      retries: 10

  api:
    build: .
    ports:
      - '8000:8000'
    environment:
      - NEO4J_URI=bolt://neo4j:7687
    depends_on:
      neo4j:
        condition: service_healthy

Port 7474 serves the Neo4j browser UI. Port 7687 is the Bolt protocol endpoint your Python code talks to. The healthcheck keeps the API from starting until Neo4j is ready to accept connections.

Graph RAG service architecture

FastAPI talks to Neo4j over Bolt and to ChromaDB on disk. The LLM drives extraction and Cypher generation.

Validation checklist: Neo4j up and reachable

Loading practice…

Quiz: Quiz

Loading practice…