Rust 实现的开源向量-图混合数据库,专为 AI 应用设计,支持高效向量搜索和图关联查询,社区热度高。
HelixDB 是一个数据库,让你在单一平台上轻松构建 AI 应用所需的全部组件。
你无需分别部署应用数据库、关系数据库、向量数据库、图数据库,也无需应用层来管理多个存储位置。HelixDB 为你的 agent 提供对公司数据的联合访问,用于记忆、公司知识库和应用。
Helix 主要采用图 + 向量数据模型,但也支持键值对、文档和关系数据。
Helix CLI 运行和管理本地实例,并与 Helix Cloud 通信。
curl -sSL "https://install.helix-db.com" | bash
已安装过?用 helix update 更新到最新版本。
helix chef 是一个交互式的一次性引导工具。它安装 HelixDB 查询技能和文档 MCP,搭建项目,启动本地实例,填充示例数据,并生成一份 HELIX_CHEF_PROMPT.md。如果有可用的编码 Agent(Claude Code、Codex 或 OpenCode),它可以交接工作并从一行代码描述中构建一个完整的应用—— 包括前端。
helix chef
就这样 — 无需任何标志。回答"你想构建什么?"并按照提示操作。
如果你想自己配置:
初始化项目。这会搭建 helix.toml、.helix/ 工作目录和一份现成的 examples/request.json。
mkdir my-helix-app && cd my-helix-app
helix init
启动本地实例。在 6969 端口运行后台容器,并等待其接受查询。
helix start dev
⚠️ 默认存储模式是内存中 — 停止实例会清除数据。使用 helix start dev --disk 在重启间保存数据,或用 --foreground 流式输出日志。
helix query dev --file examples/request.json
完成后停止实例。
helix stop dev
查询用 Rust、TypeScript、Go 或 Python DSL 编写,直接发送到运行中的实例作为 POST /v1/query 的动态请求 — 无需构建或部署步骤。SDK 生成相同的 JSON AST。以下示例与运行在 http://localhost:6969(默认 helix start dev 端口)的本地实例通信。完整的构建器目录和动态查询连线格式见《查询指南》。
安装 crate(发布为 helix-db,导入为 helix_db):
cargo init && cargo add helix-db tokio sonic-rs
把查询定义为 #[register] 函数,然后通过客户端直接运行:
use helix_db::Client;
use helix_db::dsl::prelude::*;
#[register]
pub fn add_user(name: String) {
write_batch()
.var_as(
"user",
g().add_n("User", vec![("name", name)])
.value_map(None::<Vec<String>>),
)
.returning(["user"])
}
#[register]
pub fn get_user(name: String) {
read_batch()
.var_as(
"user",
g().n_with_label("User")
.where_(Predicate::eq("name", name))
.value_map(None::<Vec<String>>),
)
.returning(["user"])
}
#[tokio::main]
async fn main() {
let client = Client::new(None).unwrap(); // defaults to http://localhost:6969
// add user
let new_user = client
.query::<sonic_rs::Value>()
.dynamic(add_user("John Doe".to_string()))
.send()
.await
.unwrap();
println!("new user: {:#}", sonic_rs::to_string_pretty(&new_user).unwrap());
// get user
let user = client
.query::<sonic_rs::Value>()
.dynamic(get_user("John Doe".to_string()))
.send()
.await
.unwrap();
println!("user: {:#}", sonic_rs::to_string_pretty(&user).unwrap());
}
安装包(Node.js 20+):
npm init -y && npm install @helix-db/helix-db
把查询定义为函数,然后 POST 到运行中的实例:
import {
Predicate, PropertyInput, PropertyProjection,
defineParams, g, param, readBatch, writeBatch,
} from "@helix-db/helix-db";
const addUserParams = defineParams({ name: param.string() });
function addUser(p = addUserParams) {
return writeBatch()
.varAs("user",
g().addN("User", { name: PropertyInput.param("name") })
.project([PropertyProjection.new("name")]),
)
.returning(["user"]);
}
const getUserParams = defineParams({ name: param.string() });
function getUser(p = getUserParams) {
return readBatch()
.varAs("user",
g().nWithLabel("User")
.where(Predicate.eqParam("name", "name"))
.project([PropertyProjection.new("name")]),
)
.returning(["user"]);
}
const HELIX_URL = "http://localhost:6969/v1/query";
// add user
const newUser = await fetch(HELIX_URL, {
method: "POST",
headers: { "content-type": "application/json" },
body: addUser().toDynamicJson(addUserParams, { name: "John Doe" }),
}).then((r) => r.json());
console.log("new user:", newUser);
// get user
const user = await fetch(HELIX_URL, {
method: "POST",
headers: { "content-type": "application/json" },
body: getUser().toDynamicJson(getUserParams, { name: "John Doe" }),
}).then((r) => r.json());
console.log("user:", user);
从本仓库安装包:
pip install -e sdks/python
用 snake_case 构建器构建动态请求,然后用客户端发送:
from helixdb import Client, Predicate, g, param, define_params, read_batch, write_batch
add_user_params = define_params({"name": param.string()})
add_user = (
write_batch()
.var_as("user", g().add_n("User", {"name": add_user_params.name}))
.returning(["user"])
)
get_user_params = define_params({"name": param.string()})
get_user = (
read_batch()
.var_as(
"user",
g()
.n_with_label("User")
.where(Predicate.eq("name", get_user_params.name))
.value_map(["name"]),
)
.returning(["user"])
)
client = Client("http://localhost:6969")
new_user = client.query().dynamic(
add_user.to_dynamic_request(add_user_params, {"name": "John Doe"})
).send()
print("new user:", new_user)
user = client.query().dynamic(
get_user.to_dynamic_request(get_user_params, {"name": "John Doe"})
).send()
print("user:", user)
HelixDB Cloud 是对象存储后端部署,集成向量和全文搜索、完整 ACID 事务、单写手配读节点、高可用性(3+ 网关和数据库节点)。Cloud 集群使用与本地实例不同的部署路径:
helix auth login # authenticate
helix workspace switch <workspace> # select workspace + project
helix project switch <project>
helix init cloud --cluster-id <cluster-id> # or: helix add cloud --name production --cluster-id <id>
helix sync production # pull gateway URL + auth contract into helix.toml
helix query production --file examples/request.json
HelixDB 作为分布式、高可用的托管服务提供。如果你有兴趣使用 Helix 的托管服务,请访问官网开始使用,或联系我们与创始人交流。
📚 文档 · [查询指南](Querying Guide)