Introducing a new way to review your PRs.

Read the announcement

helixdb / helix-db

HelixDB is an OLTP graph database with native vector and full-text search built in Rust on Object Storage.

View on GitHub

27 documents · Updated Nov 23, 2026

docs / client-sdks-and-bindings

Client SDKs and bindings

HelixDB client integrations give application developers one way to build graph queries, send them to a HelixDB server, or run them against an embedded database. Rust, Python, TypeScript, and Go expose language-shaped APIs over a shared query contract. UniFFI connects the embedded Rust runtime and native graph support to foreign-language clients.

Shared integration model

Each SDK turns application code into a query request. The request can cross the network or stay in the application process. This keeps the query model consistent while allowing each language to use its normal naming, type, and async style.

The main path through the integrations is:

flowchart LR
    App[Application code] --> SDK[Language SDK]
    SDK --> DSL[Query DSL]
    DSL --> Request[Shared query request]
    Request --> HTTP[Server query endpoint]
    Request --> Embedded[Embedded Rust database]
    Embedded --> FFI[UniFFI native boundary]
    HTTP --> Result[Query result or typed error]
    FFI --> Result

The supported integrations serve these roles:

IntegrationMain application useExecution choices
Rust SDKBuild queries with the Rust DSL and use Rust graph accessHTTP client, plus optional embedded database and native graph access
Python SDKBuild queries with Python methods and use sync or async clientsHTTP or embedded database; native graph access uses the native package
TypeScript SDKBuild typed JavaScript or TypeScript queries and use the published npm packageHTTP or embedded database; native graph access uses the separate native package
Go SDKBuild requests with Go types and execute them with a contextHTTP client; embedded and native graph features depend on separately linked bindings
UniFFI bindingsExpose the Rust embedded database and native graph object to foreign runtimesNative calls used by Python, Node, and other generated clients

References: sdks/…/lib.rs• L3-16 sdks/…/README.md• L1-8 sdks/…/README.md• L1-5 sdks/…/package.json• L1-16 sdks/…/README.md• L1-4 bindings/…/lib.rs• L3-12

Published package boundary

The TypeScript integration is published as @helix-db/helix-db for Node applications. The package exposes the query DSL, client, graph helpers, and type declarations as one application-facing surface. Embedded storage remains an optional native package so server use does not require native bindings.

The release checks install the packed artifact in a clean consumer. They compile against the published declarations and run requests through the installed package. The consumer also checks remote error meaning and confirms that an uncertain write is not replayed. This separates the public package contract from checks that use repository source files or native development builds.

References: sdks/…/package.json• L1-16 sdks/…/package.json• L44-66 sdks/…/package-smoke.mjs• L1-53 sdks/…/consumer.mjs• L1-15 sdks/…/consumer.mjs• L53-89 sdks/…/types.mts• L1-13

Query DSL contract

The query DSL describes graph reads and writes as a structured request. An application starts a read or write batch, builds traversals over nodes or edges, applies filters and transformations, and names the values that the server must return.

The shared query model includes:

  • node and edge selection
  • graph navigation and filtering
  • projections and aggregates
  • conditional branches and repeated traversals
  • runtime parameters with type information
  • index, vector search, and text search operations
  • row bindings for values that must stay linked across traversals
  • index lifecycle receipts and status values for asynchronous index work

The SDKs use different surface names. Python uses snake_case, TypeScript uses camelCase, Rust uses Rust builder names, and Go uses exported Go names. They still target the same query JSON AST. Typed parameters carry their schema with their values, while each SDK keeps language limits at its own boundary. In Python, immutable builders preserve prior query states and parameter values are checked before serialization. The Python DSL also validates index lifecycle receipts and status values at the client boundary. Its response checks allow additive fields while rejecting unknown variants and invalid identifiers.

The Go surface also carries search visibility choices and index lifecycle states into the shared request model. It rejects invalid combinations before serialization, which keeps language-level convenience from changing the server contract.

Python's DSL covers graph traversal, reads, writes, projections, row bindings, search, and index lifecycle actions. Its tests compare serialized request shapes and verify that invalid types, unsafe values, incomplete binding projections, invalid dates, and unknown lifecycle variants fail before an application sends a request. These checks protect the shared contract without changing the language-level query experience.

Parity generators exercise the same read, write, traversal, parameter, search, index, and binding shapes in each language. They produce comparable request fixtures so a surface change can be checked for both local validity and cross-language agreement.

Read the Rust DSL integration for the model that defines the query-building concepts. Read the language client APIs for the Python, TypeScript, and Go client surfaces.

References: sdks/…/dsl.rs• L1-19 sdks/…/dsl.py• L1-6 sdks/…/dsl.py• L100-127 sdks/…/dsl.py• L130-170 sdks/…/dsl.py• L1090-1215 sdks/…/dsl.py• L1622-1741 sdks/…/dsl.ts• L69-95 sdks/…/dsl.ts• L925-967 sdks/…/dsl.ts• L1120-1325 sdks/…/dsl.go• L32-40 sdks/…/dsl.go• L974-1328 sdks/…/dsl.go• L1331-1400 sdks/…/dsl_test.go• L969-1012 sdks/…/dsl_test.go• L1139-1181 sdks/…/generate_parity_fixtures.rs• L279-327 sdks/…/main.go• L35-87 sdks/…/parity_runtime_fixtures.py• L73-1196 sdks/…/generate-fixtures.ts• L36-69 sdks/…/test_dsl.py• L63-237 sdks/…/test_dsl.py• L366-427 sdks/…/test_dsl.py• L545-729 sdks/…/test_dsl.py• L739-798 sdks/…/basic.test.ts• L42-100

Query execution modes

Every client separates query construction from query execution. In server mode, the SDK sends the serialized request to POST /v2/query and turns the response into the requested application type. In embedded mode, the same request is passed to an in-process HelixDB handle.

The Rust and TypeScript clients also expose Cypher as a second query surface. Applications can send a Cypher statement or request a plan through the server or an embedded handle. The SDK keeps result and error handling consistent with DSL requests.

The modes have different ownership and routing behavior:

ModeData accessRequest controlsLifetime
ServerRemote HelixDB instanceAPI keys and server routing controls such as writer-only or warm-only requestsReuse the client for many requests
Embedded writerLocal or object-backed database in the processQuery execution only; server routing controls do not applyOpen, use, then close the database handle
Embedded readerExisting embedded database opened for readsQuery execution only; writes are rejected by the database modeOpen for read access, then close the handle

Server and embedded paths share query results and error intent, but their transport errors differ. Server clients report network and remote response failures. Embedded clients report native database and binding failures. A successful warm request may have no result body, so callers must not assume that every successful response contains rows. TypeScript preserves large response integers as bigint, and the Rust, Python, and Go surfaces retain their own lossless value rules at the client boundary.

The Python sync and async clients follow the same mode and error contract. The async client also closes response streams on success, failure, timeout, and cancellation so the client can be reused safely.

References: sdks/…/lib.rs• L105-171 sdks/…/lib.rs• L243-343 sdks/…/lib.rs• L378-486 sdks/…/lib.rs• L655-825 sdks/…/lib.rs• L929-1029 sdks/…/client.py• L27-107 sdks/…/async_client.py• L1-180 sdks/…/dsl.py• L112-170 sdks/…/dsl.ts• L74-81 sdks/…/index.ts• L239-355 sdks/…/index.ts• L391-454 sdks/…/client.test.ts• L224-305 sdks/…/client.test.ts• L499-583 sdks/…/client.test.ts• L585-809 sdks/…/client.test.ts• L811-906 sdks/…/test_client.py• L197-329 sdks/…/test_client.py• L471-580 sdks/…/test_async_client.py• L255-475 sdks/…/client.go• L151-193 sdks/…/client.go• L243-326

Embedded graph access

Graph access has two stages. The client first runs one ordinary read that selects nodes and edges. It then creates an immutable native graph from that result. Graph lookups, traversals, algorithms, and graph changes operate on the loaded snapshot without more database reads.

The graph load path is:

sequenceDiagram
    participant A as Application
    participant C as SDK client
    participant D as Server or embedded DB
    participant G as Native graph
    A->>C: Define node and edge selection
    C->>D: Run one read query
    D-->>C: Projected node and edge rows
    C->>G: Validate and load snapshot
    G-->>A: Local graph access and algorithms

A graph selection can control direction, node and edge properties, identity fields, weights, and result limits. Full graph scans require explicit acknowledgement so an application does not load a large graph by accident. The resulting graph supports common local graph work such as neighborhood access, degrees, paths, traversal, centrality, communities, cycles, layouts, and subgraphs.

Native graph access is a separate capability from ordinary query execution. Python and TypeScript load it through their native embedded package. Rust provides the native graph path directly. The standard Go SDK declares the graph API, but its published module does not include the native bindings required to use it.

References: sdks/…/graph.rs• L1-5 sdks/…/graph.rs• L70-112 sdks/…/graph.rs• L313-335 sdks/…/graph.py• L1-5 sdks/…/graph.py• L818-850 sdks/…/graph.ts• L32-105 sdks/…/graph.ts• L357-366 sdks/…/index.ts• L330-355 sdks/…/graph.go• L34-47 sdks/…/README.md• L258-265

UniFFI binding boundary

UniFFI is the native boundary for features that foreign-language code cannot run by itself. It exposes embedded database handles, storage sources, cache profiles, graph load descriptions, graph records, graph operations, and stable error categories as FFI-safe values.

The boundary keeps Rust-owned work inside native code. Foreign clients pass query bytes or typed binding values across the boundary and receive result bytes, records, or classified errors. A dedicated Tokio runtime owns database futures. This prevents foreign callback threads from having to run database work with their own runtime or stack limits.

The binding package is not the main application API. Applications use the Python or TypeScript SDK and install the matching native package when they need embedded storage or native graph access. Generated bindings and native libraries must match the SDK adapter that loads them.

Read the UniFFI bindings page for the native interface, packaging, runtime, and error contract.

References: bindings/…/helix_db.rs• L14-36 bindings/…/helix_db.rs• L106-120 bindings/…/helix_db.rs• L148-231 bindings/…/graph.rs• L100-181 bindings/…/error.rs• L1-40 bindings/…/runtime.rs• L1-24 sdks/…/test_client.py• L471-580 sdks/…/test_async_client.py• L436-532 sdks/…/client.test.ts• L100-189 sdks/…/client.test.ts• L499-583

Integration guides

The shared page gives the system view. Use the child pages for the language or boundary that you need to change:

  • Rust SDK and DSL explains query construction, HTTP execution, embedded Rust access, and native graph loading.
  • Language client SDKs compares the Python, TypeScript, and Go client APIs and their language-specific behavior.
  • UniFFI bindings explains the native interface used by embedded clients and graph adapters.

These pages should describe language-specific behavior only after the shared request, execution, and native graph model is clear.

References: sdks/…/lib.rs• L3-16 sdks/…/test_client.py• L197-220 sdks/…/test_async_client.py• L102-127 sdks/…/consumer.mjs• L1-5 sdks/…/client.test.ts• L9 sdks/…/dsl.go• L57-60

Change checklist

When these files or sections are changed, remember to consider these:

  • When the query AST or wire names change, update the Rust, Python, TypeScript, and Go builders together. A surface API can still compile while producing a request the other SDKs cannot match.
  • When a DSL value, parameter, binding, search, or index lifecycle variant changes, regenerate parity fixtures in all four SDKs. Fixture coverage must remain complete before request comparison can show a real cross-language result.
  • When response envelopes or error fields change, update each client’s success decoding and stable error classification. Remote status, error code, and readable message are separate contracts.
  • When Python async transport or close behavior changes, keep response streams closed on success, failure, timeout, and cancellation. A leaked stream can make a reusable client fail later.
  • When JavaScript number handling or datetime rules change, check both request serialization and response parsing. Large integers and out-of-range timestamps can pass type checks while changing wire values at runtime.
  • When Cypher request or plan results change, update the Rust and TypeScript server and embedded paths together. Their option guards and empty warm responses must still agree.
  • When UniFFI records, enums, or exported methods change, regenerate the foreign bindings and update the Python and Node adapters that load them.
  • When graph selection fields or projected graph metadata change, update every graph loader. The server response and native graph load specification must describe the same identity and topology.
  • When server request controls change, preserve the mode guard. Embedded requests must not silently accept controls that only a server can enforce.
  • When the TypeScript package entry point or declaration shape changes, validate the packed npm artifact in an isolated consumer. Source imports can pass while the published dist files or exports are incomplete.

Important failure modes

TriggerConsequenceGuard
One SDK emits a different AST shape or field nameEquivalent application queries behave differently across languages or fail at the serverKeep the shared query contract aligned and compare generated requests across SDKs
A new DSL or index lifecycle variant is added to one generator but not the othersOne language cannot express or safely decode the same query or statusRegenerate and compare the Rust, Go, Python, and TypeScript fixture sets together
A JavaScript integer exceeds the safe number rangeThe request or result changes valueUse the SDK’s lossless integer form such as bigint where required
A client treats an uncertain write as retryableThe mutation can be applied more than onceTreat explicit unknown-outcome errors as terminal and send the mutation once
An async response stream stays open after timeout or cancellationLater requests on the same Python client can fail or stallClose the response stream in every exit path
An embedded client receives a server-only request controlThe request is rejected instead of being routed as requestedApply writer, warm, and durability controls only to server clients
A graph selection starts with an unfiltered full scan without opt-inGraph loading fails before execution or loads more data than intendedAdd a filter or explicitly allow the full scan, then use node and edge limits where needed
The native package is missing or does not match the adapterEmbedded queries, Cypher, or native graph loading are unavailableInstall the matching native package and keep generated bindings in sync
A warm success is treated as a normal result responseThe caller tries to decode an empty body as rowsTreat the no-content warm response as success without a query payload
A package is tested from repository source but the packed artifact is stale or incompleteConsumers cannot import the public API or its declarations after releaseRun the isolated package consumer and declaration checks against the packed artifact

Key files

FileWhy to read it
sdks/…/lib.rsDefines the Rust client boundary, server and embedded modes, DSL and Cypher execution, and shared error intent.
sdks/…/dsl.rsShows how the Rust SDK presents the shared query-building contract.
sdks/…/graph.rsShows the one-read graph load model and the native graph entry point.
sdks/…/client.pyShows synchronous Python server and embedded client behavior.
sdks/…/async_client.pyShows asynchronous Python execution, cancellation, response cleanup, and native runtime use.
sdks/…/graph.pyShows the Python graph selection and native graph façade.
sdks/…/dsl.pyDefines the Python AST, typed values, immutable traversal builders, bindings, search shapes, and index lifecycle values.
sdks/…/test_client.pyChecks Python server errors, embedded modes, native errors, and server-only option guards.
sdks/…/test_async_client.pyChecks async transport cleanup, cancellation, reuse, embedded concurrency, and mode parity.
sdks/…/index.tsDefines the TypeScript client, execution modes, Cypher surface, and public package entry point.
sdks/…/dsl.tsDefines the TypeScript representation of the shared query AST and parameter values.
sdks/…/graph.tsDefines TypeScript graph selection, loading, and local graph access.
sdks/…/package.jsonDefines the published package entry points, supported Node runtime, and cross-SDK parity commands.
sdks/…/client.test.tsChecks TypeScript routing, Cypher, embedded access, lossless values, and error behavior.
sdks/…/lost-response-probe.tsChecks that an uncertain write is terminal and is not replayed.
sdks/…/consumer.mjsExercises the public package contract, error decoding, and no-replay behavior after installation.
sdks/…/dsl.goDefines Go request values, typed parameters, search controls, and index lifecycle decoding.
sdks/…/dsl_test.goChecks Go request shapes, lifecycle variants, error classification, and server request behavior.
sdks/…/client.goDefines Go server execution, embedded construction, request controls, and errors.
bindings/…/helix_db.rsExposes embedded storage sources, handles, query execution, and close behavior.
bindings/…/graph.rsExposes FFI-safe graph records, operations, and native graph loading.
bindings/…/error.rsDefines the stable error categories returned across the native boundary.
bindings/…/runtime.rsDefines the dedicated runtime that owns asynchronous native work.