---
title: TypeScript SDK
description: "The @cuitty/sdk package — a fail-silent, batched HTTP client for TypeScript and Node.js applications."
section: SDK
order: 1
updatedAt: 2026-04-27
slug: sdk/typescript
---
# 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

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

## Quickstart

```typescript
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

```typescript
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

| Plugin       | Import                                  | Captures                              |
| ------------ | --------------------------------------- | ------------------------------------- |
| `auditPlugin` | `@cuitty/sdk/plugins/audit`             | HTTP request/response audit events    |
| `logsPlugin`  | `@cuitty/sdk/plugins/logs`              | Pino log records                      |
| `deploysPlugin` | `@cuitty/sdk/plugins/deploys`         | CI/CD deploy events                   |
| `repositoryPlugin` | `@cuitty/sdk/plugins/repository`   | Git metadata                          |
| `configsPlugin` | `@cuitty/sdk/plugins/configs`         | Config file change watcher            |
| `costsPlugin` | `@cuitty/sdk/plugins/costs`             | Cloud cost metrics                    |

## Hono adapter

```typescript
import { Hono } from "hono";

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

## Lifecycle

```typescript
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](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

- [Wire protocol](/docs/reference/wire-protocol)
- [SDK parity & divergence](/docs/sdk/parity)
- [Python SDK](/docs/sdk/python)
- [Curl examples](/docs/sdk/curl)