SDK

TypeScript SDK

The @cuitty/sdk package — a fail-silent, batched HTTP client for TypeScript and Node.js applications.

TypeScript SDK

@cuitty/sdk is the canonical client for sending events from a TypeScript or Bun application. It is single-package, tree-shakeable, fail-silent, and batched.

Install

bun add @cuitty/sdk
# or
npm install @cuitty/sdk

Quickstart

import { createCuittyClient } from "@cuitty/sdk";
import { auditPlugin } from "@cuitty/sdk/plugins/audit";

const cuitty = createCuittyClient({
  portalUrl: "https://app.cuitty.com",
  projectId: process.env.CUITTY_PROJECT_ID!,
  apiKey: process.env.CUITTY_API_KEY!,
});

cuitty.use(auditPlugin());
cuitty.start();

await cuitty.emit({
  type: "audit",
  timestamp: new Date().toISOString(),
  data: {
    actor: "alice@example.com",
    action: "secret.rotate",
    resource: "stripe.live_key",
  },
});

Configuration

interface CuittyConfig {
  portalUrl: string;          // Cuitty portal base URL
  projectId: string;          // Project UUID
  apiKey: string;             // cuitty_sk_...
  flushInterval?: number;     // ms between flushes (default 5000)
  maxBufferSize?: number;     // events before forced flush (default 500)
  timeout?: number;           // per-request HTTP timeout (default 10000)
  debug?: boolean;            // log to stderr (default false)
  enabled?: boolean;          // kill switch (default true)
}

Plugins

PluginImportCaptures
auditPlugin@cuitty/sdk/plugins/auditHTTP request/response audit events
logsPlugin@cuitty/sdk/plugins/logsPino log records
deploysPlugin@cuitty/sdk/plugins/deploysCI/CD deploy events
repositoryPlugin@cuitty/sdk/plugins/repositoryGit metadata
configsPlugin@cuitty/sdk/plugins/configsConfig file change watcher
costsPlugin@cuitty/sdk/plugins/costsCloud cost metrics

Hono adapter

import { Hono } from "hono";

const app = new Hono();
app.use("*", cuitty.honoMiddleware());

Lifecycle

cuitty.start();          // Begin buffering and flushing
await cuitty.flush();    // Force flush (call before process exit)
await cuitty.shutdown(); // Flush + stop timers

Live performance numbers

See live benchmarks at https://benchmarks.cuitty.com/sdks/typescript. The benchmark harness re-runs on every release tag and posts results back to the marketing site.

See also