TypeScript SDK
RawTree TypeScript client and OpenTelemetry helper packages.
TypeScript SDK
RawTree publishes two TypeScript packages:
@rawtree/sdkfor query, insert, and table metadata.@rawtree/otelfor OpenTelemetry setup, RawTree trace export, and optional AI SDK integration.
The SDK source is public at rawtreedb/rawtree-sdk-typescript.
Install
npm install @rawtree/sdkFor OpenTelemetry helpers:
npm install @rawtree/otelAPI client
import { RawTree } from "@rawtree/sdk";
const rawtree = new RawTree({
apiKey: process.env.RAWTREE_API_KEY!,
});
await rawtree.insert("events", [
{ event: "signup", user_id: "u_123" },
]);
const result = await rawtree.query<{ event: string; count: number }>(
"SELECT event, count() AS count FROM events GROUP BY event",
);
const tables = await rawtree.tables.list();
const schema = await rawtree.tables.describe("events");The SDK sends the API key as Authorization: Bearer <apiKey>. See the API reference for the underlying HTTP surface.
OpenTelemetry and AI integration
Use @rawtree/otel when you want a TypeScript app to export OpenTelemetry traces to RawTree, including AI SDK telemetry:
import { registerOTel, aiSdkIntegration } from "@rawtree/otel";
const rawtree = registerOTel({
serviceName: "ai-sdk",
apiKey: process.env.RAWTREE_API_KEY!,
environment: "production",
integrations: [aiSdkIntegration()],
});
// Run your app or AI agent here.
await rawtree.shutdown();For native OTLP endpoints, Collector setup, destination tables, and smoke tests, see the OpenTelemetry guide.