Getting started

From one command to a server your Neo4j drivers can talk to. A few minutes.

  1. Run it

    One command starts GraphBuff with the movies graph loaded. Needs Docker.

    Run it with the movies graph

    $ docker run --rm -p 127.0.0.1:7475:7475 -p 127.0.0.1:7687:7687 ghcr.io/janvencl/graphbuff --demo movies
    Build from source instead
    # Linux and macOS
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    # Windows: download rustup-init.exe from rustup.rs
    rustup update stable
    rustc --version   # 1.89 or newer
    
    git clone https://github.com/JanVencl/graphbuff && cd graphbuff
    cargo run --release -p graphbuff-cli -- -i examples/movies.cypher
  2. See the first result

    The server prints two lines and waits: HTTP/JSON on port 7475, Bolt on 7687, seven nodes and eight relationships loaded. From a second terminal, ask who acted with Keanu Reeves.

    graphbuff-server listening on http://0.0.0.0:7475 and bolt://0.0.0.0:7687 (in-memory databases)
    demo `movies` loaded: 7 nodes, 8 relationships
    
    curl -s http://127.0.0.1:7475/query -H 'Content-Type: application/json' \
      -d '{"query": "MATCH (:Person {name: \"Keanu Reeves\"})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(co) RETURN co.name AS coActor, count(m) AS movies ORDER BY movies DESC"}'
    {"columns":["coActor","movies"],"rows":[["Carrie-Anne Moss",2],["Hugo Weaving",1]],"stats":{...}}
  3. Ask your own questions

    Any Cypher goes in query; values go in params, so they never need escaping. The server also warns that it has no token: the command publishes its ports to this machine only, which is why that is safe here.

    curl -s http://127.0.0.1:7475/query -H 'Content-Type: application/json' \
      -d '{"query": "MATCH p = shortestPath((h:Person {name: $from})-[*]-(l:Person {name: $to})) RETURN [n IN nodes(p) | coalesce(n.name, n.title)] AS path",
           "params": {"from": "Hugo Weaving", "to": "Lana Wachowski"}}'
    {"columns":["path"],"rows":[[["Hugo Weaving","The Matrix","Lana Wachowski"]]],"stats":{...}}
  4. Keep the data

    With --data databases live in a directory and survive restarts. Add --persistent for disk-resident storage that can grow past RAM.

    cargo run --release -p graphbuff-cli -- --data ./data
    cargo run --release -p graphbuff-cli -- --data ./data --persistent
    
    graphbuff> CREATE DATABASE movies;
    graphbuff> :use movies
    graphbuff> :source examples/movies.cypher
  5. Start the server

    HTTP/JSON on port 7475, Bolt on 7687. It listens on localhost unless you bind it elsewhere; set a token or a users file before you do.

    cargo run --release -p graphbuff-server -- --data ./data --bolt 127.0.0.1:7687 --token s3cret
    
    curl -s http://127.0.0.1:7475/query \
      -H 'Authorization: Bearer s3cret' -H 'Content-Type: application/json' \
      -d '{"query": "MATCH (p:Person) RETURN p.name AS name ORDER BY name"}'
    {"columns":["name"],"rows":[["Carrie-Anne Moss"],["Hugo Weaving"],...],"stats":{...}}
  6. Connect your application

    Use the official Neo4j driver over Bolt, plain HTTP from any language, or embed the engine in a Rust program.

    pip install neo4j
    
    from neo4j import GraphDatabase
    with GraphDatabase.driver("bolt://127.0.0.1:7687", auth=("neo4j", "s3cret")) as driver:
        records, _, _ = driver.execute_query("MATCH (p:Person) RETURN p.name AS name", database_="movies")
        for r in records:
            print(r["name"])
  7. Optional: turn on the GPU

    Needs a GPU with Vulkan, Direct3D 12 or Metal. EXPLAIN then shows (wgpu; …) on the steps that run on the card. On Windows with the GNU toolchain, see the README for the extra linker setup.

    cargo run --release -p graphbuff-cli --features gpu -- --gpu
    cargo run --release -p graphbuff-server --features gpu -- --gpu --bolt 127.0.0.1:7687
ExamplesReal queries with the output they returnFeaturesStorage engines, GPU kernels, securityDocumentationEvery option and endpointGet release updatesAn Atom feed of new versions