tool

Nucleus Client

The typed database client that lives in every Neutron SDK. All 14 data models through one API — SQL, KV, Vector, Graph, Time-series, and nine more — idiomatic in whichever language you reach for.

All 14 models. Every language. One API shape.

Available
14Data Models
7Language Clients
pgwireOver Postgres Protocol
ACIDMulti-Model Tx

One mental model, seven runtimes.

Nucleus speaks the PostgreSQL wire protocol, which means you can connect with any Postgres client ever written. The Nucleus Client goes further: a hand-crafted, typed surface for each SDK language that gives you accessors for every non-SQL model too — client.kv(), client.vector(), client.graph(), client.stream(), client.cdc() — idiomatic to the language you're in.

TypeScript
import { nucleus } from "@neutron-build/data";
const db = nucleus(process.env.DATABASE_URL!);

const hits = await db.vector("docs").search(embedding).k(10).execute();
await db.kv("sessions").set(sid, user, { ttl: 3600 });
await db.graph().shortestPath(a, b).limit(5).execute();
Rust
use neutron_nucleus::NucleusClient;
let db = NucleusClient::connect(&env::var("DATABASE_URL")?).await?;

let hits = db.vector().search("docs", &embedding).k(10).execute().await?;
db.kv().set("sessions", &sid, &user, Some(3600)).await?;
db.graph().shortest_path(a, b).limit(5).execute().await?;
Go
import "github.com/neutron-dev/neutron-go/nucleus"
db := nucleus.Connect(os.Getenv("DATABASE_URL"))

hits, _ := db.Vector("docs").Search(emb).K(10).Do(ctx)
db.KV("sessions").Set(ctx, sid, user, nucleus.TTL(3600))
db.Graph().ShortestPath(a, b).Limit(5).Do(ctx)
Python
from neutron_py import nucleus
db = await nucleus.connect(os.environ["DATABASE_URL"])

hits = await db.vector("docs").search(embedding).k(10).execute()
await db.kv("sessions").set(sid, user, ttl=3600)
await db.graph().shortest_path(a, b).limit(5).execute()
Typed per language
Full type inference in TypeScript and Rust. Generics in Go 1.22+. Pydantic models in Python. Comptime shape checks in Zig. Parametric types in Julia.
All 14 models
SQL, Columnar, KV, Vector, TimeSeries, Document, Graph, FTS, Geo, Blob, Streams, Datalog, CDC, PubSub — one connection, one client.
Multi-model transactions
ACID across models. Insert a SQL row, store its embedding, append a CDC event, publish to a topic — commit or rollback the whole thing.
Pool-aware
Connection pooling, prepared statements, context cancellation — handled by the client. Your code doesn't open or close sockets.
Just Postgres if you want
Any PostgreSQL client (psql, pgx, node-postgres, psycopg) works. The typed clients are better, but the wire protocol is the contract.
OpenTelemetry
Traces propagate automatically. Each query is a span with parameter count, model, rows returned, duration. Works with any OTel collector.

Multi-model atomically.

This is the thing a row-only ORM can't do. Start a transaction, touch four different storage engines inside it, commit — or roll it all back. No two-phase-commit dance between separate services.

Rust
let mut tx = db.begin().await?;

let id: i64 = tx.sql()
    .query_one("INSERT INTO articles (title) VALUES ($1) RETURNING id", &[&title])
    .await?;

tx.vector().insert("articles", id, &embed(&body)).await?;
tx.fts().index("articles", id, &body).await?;
tx.cdc().emit("articles.created", &json!({ "id": id })).await?;

tx.commit().await?; // all four writes land, or none

What it's for

Any app that reads or writes to Nucleus. In practice that's every Neutron app, because the SDKs are designed around this client. You can also pull it in standalone — drop @neutron-build/data into a non-Neutron Node app and get typed access to a Nucleus cluster without buying into the framework.

Client vs. ORM

The Client gives you typed accessors and query builders — you're still writing queries by hand, just safely. The ORM (planned) sits on top and generates schema types, handles migrations, and lets you join across models with a fluent surface. Use the Client today; drop in the ORM when it ships.

Part of a bigger system

The Client is Nucleus's front door. Every Neutron SDK wraps it. Every MCP tool in Studio speaks through it. Every migration the CLI runs lands through it. If you're touching a Neutron app, you're touching this API.