Skip to main content

JavaScript quickstart (web)

Get started with LiveKit and JavaScript

Tip

Check out the dedicated quickstarts for React or Next.js if you're using one of those platforms.

Voice AI quickstart

To build your first voice AI app for web, use the following quickstart and the starter app. Otherwise follow the getting started guide below.

Getting started guide

This guide covers the basics to connect to LiveKit from a JavaScript app.

Install LiveKit SDK

Install the LiveKit SDK:

yarn add livekit-client

Join a room

Note that this example hardcodes a token. In a real app, you’ll need your server to generate a token for you.

import { Room } from 'livekit-client';
const wsURL = '<your LiveKit server URL>';
const token = '<generate a token>';
const room = new Room();
await room.connect(wsURL, token);
console.log('connected to room', room.name);
// Publish local camera and mic tracks
await room.localParticipant.enableCameraAndMicrophone();

Next steps

The following resources are useful for getting started with LiveKit in a JavaScript app.

Generating tokens

Guide to generating authentication tokens for your users.