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

# JavaScript SDK Overview

> Build web applications with Pipecat’s JavaScript client library

The Pipecat JavaScript SDK provides a lightweight client implementation that handles:

* Device and media stream management
* Connecting to Pipecat bots
* Messaging with Pipecat bots and handling responses using the RTVI standard
* Managing session state and errors

## Installation

Install the SDK and a transport implementation (e.g. Daily for WebRTC):

```bash theme={null}
npm install @pipecat-ai/client-js
npm install @pipecat-ai/[daily-transport, small-webrtc-transport, etc.]
```

## Example

Here's a simple example using Daily as the transport layer:

```javascript theme={null}
import { PipecatClient } from "@pipecat-ai/client-js";
import { DailyTransport } from "@pipecat-ai/daily-transport";

// Handle incoming audio from the bot
function handleBotAudio(track, participant) {
  if (participant.local || track.kind !== "audio") return;

  const audioElement = document.createElement("audio");
  audioElement.srcObject = new MediaStream([track]);
  document.body.appendChild(audioElement);
  audioElement.play();
}

// Create and configure the client
const pcClient = new PipecatClient({
  transport: new DailyTransport(),
  enableMic: true,
  callbacks: {
    onTrackStarted: handleBotAudio,
  },
});

// Connect to your bot
pcClient.connect({
  url: "https://your-daily-room-url",
  token: "your-daily-token",
});
```

## Explore the SDK

<CardGroup cols={2}>
  <Card title="Client Constructor" icon="cube" href="/api-reference/client/js/client-constructor">
    Configure your client instance with transport and callbacks
  </Card>

  <Card title="Client Methods" icon="code" href="/api-reference/client/js/client-methods">
    Core methods for interacting with your bot
  </Card>

  <Card title="Callbacks & Events" icon="bell" href="/api-reference/client/js/callbacks">
    Handle bot events, messages, and state changes
  </Card>

  <Card title="Transport Packages" icon="network-wired" href="/api-reference/client/js/transports/transport">
    Daily, SmallWebRTC, WebSocket, and other transports
  </Card>
</CardGroup>

The Pipecat JavaScript SDK implements the [RTVI standard](/client/rtvi-standard) for real-time AI inference, ensuring compatibility with any RTVI-compatible server and transport layer.
