Skip to content

JavaScript SDK

npm install @nimbus/sdk
yarn add @nimbus/sdk

Initializing the client

import { NimbusClient } from "@nimbus/sdk";

const client = new NimbusClient({ apiKey: process.env.NIMBUS_API_KEY });

Creating a record

await client.buckets.records.create("my-first-bucket", {
  name: "hello-world",
  value: 42,
});

Pagination

for await (const record of client.buckets.records.list("my-first-bucket")) {
  console.log(record.name, record.value);
}

The async iterator follows the cursor described in Pagination automatically.

Error handling

import { NimbusAPIError } from "@nimbus/sdk";

try {
  await client.buckets.records.get("my-first-bucket", "missing");
} catch (err) {
  if (err instanceof NimbusAPIError) {
    console.error(err.code, err.message, err.requestId);
  }
}

Browser usage

Never initialize the SDK with a live API key in browser code — use a readonly key or proxy requests through your backend. See Authentication → Key types.