> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brew.new/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript Installation

> Install `@brew.new/sdk` with npm, pnpm, yarn, or bun. Covers Node 20+ requirements, client configuration options including timeout and retries, and a first validation request.

## Install

<CodeGroup>
  ```bash npm theme={null}
  npm install @brew.new/sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @brew.new/sdk
  ```

  ```bash yarn theme={null}
  yarn add @brew.new/sdk
  ```

  ```bash bun theme={null}
  bun add @brew.new/sdk
  ```
</CodeGroup>

## Package

| Property | Value                                                                          |
| -------- | ------------------------------------------------------------------------------ |
| Package  | [`@brew.new/sdk`](https://www.npmjs.com/package/@brew.new/sdk)                 |
| Runtime  | Node 20 or newer                                                               |
| Repo     | [github.com/GetBrew/typescript-sdk](https://github.com/GetBrew/typescript-sdk) |

<Warning>
  The SDK is server-first. Do not use it directly in browser code with a
  real API key.
</Warning>

## Create A Client

Generate an API key at
[brew.new/settings/api](https://brew.new/settings/api). Each key is
bound to one brand at creation — switch to the right brand in the
dashboard before clicking create.

```ts theme={null}
import { createBrewClient } from '@brew.new/sdk'

const brew = createBrewClient({
  apiKey: process.env.BREW_API_KEY!,
})
```

## Configuration

The client accepts these options:

```ts theme={null}
import { createBrewClient } from '@brew.new/sdk'

const brew = createBrewClient({
  apiKey: process.env.BREW_API_KEY!,
  baseUrl: 'https://brew.new/api',
  timeoutMs: 30_000,
  maxRetries: 2,
  userAgent: 'my-app/1.0.0',
  fetch: globalThis.fetch,
})
```

### Common `baseUrl` values

* `https://brew.new/api`
* `https://staging.brew.new/api`
* `http://localhost:3000/api`

<Note>
  Email generation (`brew.emails.generate`) takes 30–90 seconds. Set
  `timeoutMs` to at least `240_000` (4 minutes) if your workflow
  generates emails. The default 30-second timeout will cause
  generation calls to fail.
</Note>

## First Request

```ts theme={null}
const { data: domains } = await brew.domains.list()
console.log(domains)
```

## What To Read Next

<CardGroup cols="2">
  <Card title="Quickstart" icon="rocket" href="/sdks/typescript/quickstart">
    Walk through contacts, templates, emails, and sends.
  </Card>

  <Card title="Error Handling" icon="triangle-exclamation" href="/sdks/typescript/error-handling">
    See how `BrewApiError` works.
  </Card>
</CardGroup>

## Need Help?

Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:

<Tabs>
  <Tab title="Self-Service Tools">
    <CardGroup cols="2">
      <Card title="Search Documentation" icon="magnifying-glass" color="#c44925">
        Type in the "Ask any question" search bar at the top left to instantly find relevant documentation pages.
      </Card>

      <Card title="ChatGPT/Claude Integration" icon="robot" color="#c44925">
        Click "Open in ChatGPT" at the top right of any page to analyze documentation with ChatGPT or Claude for deeper insights.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Talk to Our Team">
    <CardGroup cols="2">
      <Card title="Schedule a Call" icon="calendar" color="#c44925" href="https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ1iYoRUG1J792XQpbuQLjSRRDupr7MwraFK-HQRCtTYdBmrQi8nZu2qXfzKQigb8gbKJK3KN3-R">
        Book time with our founders for personalized guidance on strategy, best practices, or complex implementation questions.
      </Card>

      <Card title="Call Us Directly" icon="phone" color="#c44925">
        Need immediate assistance? Reach us at **+1-(332)-203-2145** for urgent issues or time-sensitive questions.
      </Card>

      <Card title="Slack Channel" icon="slack" color="#c44925">
        Our preferred support channel. You'll receive an invite after signup for direct founder support and fast responses.
      </Card>

      <Card title="Email Support" icon="envelope" color="#c44925" href="mailto:support@brew.new">
        Contact us at **[support@brew.new](mailto:support@brew.new)** for detailed inquiries or if you prefer not to use Slack.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
