{
  "slug": "sdk/typescript",
  "title": "TypeScript SDK",
  "description": "The @cuitty/sdk package — a fail-silent, batched HTTP client for TypeScript and Node.js applications.",
  "url": "https://cuitty.com/docs/sdk/typescript",
  "markdown_url": "https://cuitty.com/docs/sdk/typescript.md",
  "json_url": "https://cuitty.com/docs/sdk/typescript.json",
  "frontmatter": {
    "title": "TypeScript SDK",
    "description": "The @cuitty/sdk package — a fail-silent, batched HTTP client for TypeScript and Node.js applications.",
    "order": 1,
    "section": "SDK",
    "updatedAt": "2026-04-27"
  },
  "headings": [
    {
      "depth": 1,
      "slug": "typescript-sdk",
      "text": "TypeScript SDK"
    },
    {
      "depth": 2,
      "slug": "install",
      "text": "Install"
    },
    {
      "depth": 2,
      "slug": "quickstart",
      "text": "Quickstart"
    },
    {
      "depth": 2,
      "slug": "configuration",
      "text": "Configuration"
    },
    {
      "depth": 2,
      "slug": "plugins",
      "text": "Plugins"
    },
    {
      "depth": 2,
      "slug": "hono-adapter",
      "text": "Hono adapter"
    },
    {
      "depth": 2,
      "slug": "lifecycle",
      "text": "Lifecycle"
    },
    {
      "depth": 2,
      "slug": "live-performance-numbers",
      "text": "Live performance numbers"
    },
    {
      "depth": 2,
      "slug": "see-also",
      "text": "See also"
    }
  ],
  "body_markdown": "# TypeScript SDK\n\n`@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.\n\n## Install\n\n```bash\nbun add @cuitty/sdk\n# or\nnpm install @cuitty/sdk\n```\n\n## Quickstart\n\n```typescript\nimport { createCuittyClient } from \"@cuitty/sdk\";\nimport { auditPlugin } from \"@cuitty/sdk/plugins/audit\";\n\nconst cuitty = createCuittyClient({\n  portalUrl: \"https://app.cuitty.com\",\n  projectId: process.env.CUITTY_PROJECT_ID!,\n  apiKey: process.env.CUITTY_API_KEY!,\n});\n\ncuitty.use(auditPlugin());\ncuitty.start();\n\nawait cuitty.emit({\n  type: \"audit\",\n  timestamp: new Date().toISOString(),\n  data: {\n    actor: \"alice@example.com\",\n    action: \"secret.rotate\",\n    resource: \"stripe.live_key\",\n  },\n});\n```\n\n## Configuration\n\n```typescript\ninterface CuittyConfig {\n  portalUrl: string;          // Cuitty portal base URL\n  projectId: string;          // Project UUID\n  apiKey: string;             // cuitty_sk_...\n  flushInterval?: number;     // ms between flushes (default 5000)\n  maxBufferSize?: number;     // events before forced flush (default 500)\n  timeout?: number;           // per-request HTTP timeout (default 10000)\n  debug?: boolean;            // log to stderr (default false)\n  enabled?: boolean;          // kill switch (default true)\n}\n```\n\n## Plugins\n\n| Plugin       | Import                                  | Captures                              |\n| ------------ | --------------------------------------- | ------------------------------------- |\n| `auditPlugin` | `@cuitty/sdk/plugins/audit`             | HTTP request/response audit events    |\n| `logsPlugin`  | `@cuitty/sdk/plugins/logs`              | Pino log records                      |\n| `deploysPlugin` | `@cuitty/sdk/plugins/deploys`         | CI/CD deploy events                   |\n| `repositoryPlugin` | `@cuitty/sdk/plugins/repository`   | Git metadata                          |\n| `configsPlugin` | `@cuitty/sdk/plugins/configs`         | Config file change watcher            |\n| `costsPlugin` | `@cuitty/sdk/plugins/costs`             | Cloud cost metrics                    |\n\n## Hono adapter\n\n```typescript\nimport { Hono } from \"hono\";\n\nconst app = new Hono();\napp.use(\"*\", cuitty.honoMiddleware());\n```\n\n## Lifecycle\n\n```typescript\ncuitty.start();          // Begin buffering and flushing\nawait cuitty.flush();    // Force flush (call before process exit)\nawait cuitty.shutdown(); // Flush + stop timers\n```\n\n## Live performance numbers\n\nSee 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.\n\n## See also\n\n- [Wire protocol](/docs/reference/wire-protocol)\n- [SDK parity & divergence](/docs/sdk/parity)\n- [Python SDK](/docs/sdk/python)\n- [Curl examples](/docs/sdk/curl)",
  "links_out": [
    "https://benchmarks.cuitty.com/sdks/typescript",
    "/docs/reference/wire-protocol",
    "/docs/sdk/parity",
    "/docs/sdk/python",
    "/docs/sdk/curl"
  ]
}