---
title: "Use Kitsune in TypeScript"
description: "Import Kitsune and run a crawl from a Bun script."
canonical_url: "https://kitsune.carsxe.com/docs/typescript"
markdown_url: "https://kitsune.carsxe.com/docs/typescript.md"
last_updated: "2026-11-24"
x_farming_labs_generated_preamble: true
---

# Use Kitsune in TypeScript
URL: /docs/typescript
LLM index: /llms.txt
Description: Import Kitsune and run a crawl from a Bun script.

# Use Kitsune in TypeScript

Use `Kitsune` when your application needs to read a crawl result or drive the browser directly. Complete the [CLI setup](/docs/getting-started#1-set-up-kitsune) first.

## Run a crawl from code

Save this as `crawl.ts` at the repository root. Bun resolves `kitsune` from the installed workspace.

```ts
import { Kitsune } from 'kitsune'

const kit = await Kitsune.launch()

try {
  const record = await kit.crawl('https://example.com')
  console.log(record.verdict, record.data)
} finally {
  await kit.close()
}
```

```bash
bun run crawl.ts
```

Expect `ok` and an object with the title `Example Domain`. The library returns the [record](/docs/reference/records) to your script. Use `Store` if you want to persist those records as JSONL.

## Import from another Bun project

Register the local package from the Kitsune checkout:

```bash
cd packages/kitsune
bun link
```

Then run `bun link kitsune` in your other project and use the same import.

## Next steps

- [Automate browser actions](/docs/guides/browser-control) for forms and multi-step flows.
- [Kitsune API](/docs/reference/kit-api) for session options and method signatures.

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
