---
title: Installation
description: Install the package and connect all widgets with one API key pair.
icon: Package
---

Use this procedure to add Coristen to a React application.

## Get the keys

1. In Coristen, open **Settings > API keys**.
2. Create an API key pair.
3. Copy the public key. Its prefix is `coristen_pk_`.
4. Store the server key in a safe location. Coristen shows this key only once.

Use the same public key for the floating widget, dock, modal, and contact form.
Use the server key only for [customer identity](/customer-identity).

## Install the package

```package-install
@coristen/widget
```

## Add chat

Import the CSS file once in your application.

```tsx title="components/support.tsx"
"use client"

import { CoristenWidget } from "@coristen/widget"
import "@coristen/widget/styles.css"

export default function Support() {
  return <CoristenWidget apiKey="coristen_pk_..." />
}
```

Replace `coristen_pk_...` with your public key. Add `Support` to your application layout.

## Set an environment variable

For Next.js, put the public key in `.env.local`:

```bash title=".env.local"
NEXT_PUBLIC_CORISTEN_KEY=coristen_pk_...
```

Use this variable in the component:

```tsx
<CoristenWidget apiKey={process.env.NEXT_PUBLIC_CORISTEN_KEY!} />
```

Use this same variable for the other widgets.
Do not put the server key in a variable with the `NEXT_PUBLIC_` prefix.

## Check the installation

1. Open your website.
2. Select the chat button.
3. Send a message.
4. In Coristen, open **Conversations**.
5. Make sure that the message is in the inbox.

If Coristen blocks the website, check [Allowed websites](/security).
To add a form, use the [contact form procedure](/contact-form).
