> ## Documentation Index
> Fetch the complete documentation index at: https://helix-digitalocean.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Rust SDK

> Getting started with HelixDBs Rust SDK.

[helix-rs](https://github.com/HelixDB/helix-rs) is a Rust library for interacting with [helix-db](https://github.com/HelixDB/helix-db) a powerful graph-vector database written in rust. It enables intuitive and type-safe access to graph-based and vector-based queries, making it ideal for building knowledge graphs, search systems, and LLM pipelines.

## Installation

<CodeGroup>
  ```bash Cargo CLI theme={null}
  cargo add helix-rs
  cargo add serde
  cargo add tokio
  ```

  ```toml Cargo.toml theme={null}
  [dependencies]
  helix-rs = "0.1.9"
  tokio = { version = "1.47.1", features = ["full"] }
  serde = { version = "1.0.219", features = ["derive"] }
  ```
</CodeGroup>

## Quick Start

<CodeGroup>
  ```rust main.rs theme={null}
  use helix_rs::{HelixDB, HelixDBClient};
  use serde_json::json;

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      // Initialize the client (port defaults to 6969 if you pass None)
      let client = HelixDB::new(Some("http://localhost"), Some(6969), None);

      let payload = json!({
          "name": "John",
          "age": 20,
      });

      let result: serde_json::Value = client.query("AddUser", &payload).await?;
      println!("Created user: {result:#?}");

      Ok(())
  }

  ```

  ```js queries.hx theme={null}
  QUERY AddUser (name: String, age: U8) =>
      user <- AddN<User>({
          name: name,
          age: age
      })
      RETURN user

  ```

  ```js schema.hx theme={null}
  N::User {
      name: String,
      age: U8
  }
  ```
</CodeGroup>

## Configuration

### Custom Endpoint and Port

You can specify a custom endpoint and port when initializing the client:

```rust theme={null}
let client = HelixDB::new(Some("https://my-endpoint.com"), Some(8080), Some("my-api-key")); // Uses port 8080
```
