README.md

June 24, 2026 · View on GitHub

 ███████╗████████╗██████╗ ██╗   ██╗██╗  ██╗███████╗
 ██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝██║ ██╔╝██╔════╝
 ███████╗   ██║   ██████╔╝ ╚████╔╝ █████╔╝ █████╗
 ╚════██║   ██║   ██╔══██╗  ╚██╔╝  ██╔═██╗ ██╔══╝
 ███████║   ██║   ██║  ██║   ██║   ██║  ██╗███████╗
 ╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═╝╚══════╝
                   [ n e o 4 j ]

CI License: MIT stryke

[NEO4J GRAPH CLIENT FOR STRYKE // CYPHER QUERY + PARAMS + RUN + SCHEMA INTROSPECTION // BOLT]

"Graphs, one stryke pipe at a time."

Neo4j graph database client for stryke. Parametrized Cypher query and run, scalar/row helpers, and schema introspection (labels, relationship types, property keys, indexes, constraints) against any Neo4j 4.x/5.x over the Bolt protocol — via neo4rs, the pure-Rust driver. Opt-in package tier.

strykelang · MenkeTechnologiesMeta · stryke-postgres · stryke-mssql

Read the Docs · Engineering Report


Table of Contents


[0x00] Install

s add github.com/MenkeTechnologies/stryke-neo4j

On first use Neo4j, stryke dlopens the cdylib in-process and registers every neo4j__* export.


[0x01] Quick start

use Neo4j

var %conn = ( uri => "neo4j://localhost:7687", user => "neo4j", password => $ENV{NEO4J_PASS} )

# write with named params ($name placeholders)
Neo4j::run(
    "CREATE (p:Person {id: $id, name: $name})",
    params => { id => 1, name => "Ada" },
    %conn,
)

# query — each row is a hashref keyed by RETURN aliases
val @people = Neo4j::query(
    "MATCH (p:Person) WHERE p.id = $id RETURN p.name AS name",
    params => { id => 1 },
    %conn,
)
p $people[0]{name}        # Ada

# scalar
p Neo4j::scalar("MATCH (p:Person) RETURN count(p) AS n", %conn)

# schema
p Neo4j::labels(%conn)    # [ { label => "Person" }, ... ]

[0x02] Connecting

%conn (or $NEO4J_URL as a Bolt-URI fallback):

KeyDefaultNotes
uri127.0.0.1:7687Bolt URI: neo4j://, neo4j+s://, bolt://, …
userneo4j
password
databaseserver defaultFor multi-database servers

A neo4rs Graph (connection pool) is cached per (uri, user, db); a pool whose call errors is evicted and reopened on the next call.


[0x03] Architecture

  • Driverneo4rs, the pure-Rust Bolt protocol client. No JVM, no official-driver FFI.
  • Blocking facade — neo4rs is async, so the cdylib owns one tokio runtime and block_ons each call, matching the sync model the other stryke data packages use.
  • Rows as JSON — neo4rs deserializes each Bolt row straight into JSON, so a returned node or relationship becomes its property map and arbitrary results round-trip without a per-query schema.
  • Parametrized Cypher$name placeholders are bound from params, so values never enter the query text — no string interpolation, no injection.

[0x04] API reference

GroupFunctions
Livenessversion, ping, server_info
Queryquery, query_one, scalar, query_values, query_column
Writerun, batch (transaction)
Graph helperscreate_node, merge_node, set_props, get_node, exists_node, create_rel, merge_rel, delete_rel, delete_node, delete_nodes, degree, node_count, relationship_count, count_property_values
Schemacreate_index, create_constraint, drop_index, drop_constraint
Introspectionlabels, relationship_types, property_keys, indexes, constraints, databases
Planningexplain, profile
Cypher helpersescape, quote_literal, quote_ident, valid_identifier, format_value
URL helpersparse_url, redact_url, build_url

The graph/schema convenience helpers take scalar properties and safely backtick-quote labels, relationship types, and property names (which Cypher can't parametrize); use run with hand-written Cypher for list/map properties or anything more elaborate.


[0x05] Build & test

make debug       # cargo build
make test        # cargo test, then `s test t/` (live needs $NEO4J_URL)
make install     # s pkg install -g .

cargo test runs the in-crate unit tests (Bolt-URI parse/redact, defaults, params) with no database. Point $NEO4J_URL (+ user/pass) at a throwaway Neo4j container to exercise the query path.


[0x06] License

MIT · MenkeTechnologies