LiveKit LogoDocs

Quickstart Guides / Backend / Node.js

NodeJS Backend Quickstart

On this page

1. Install Livekit Server SDK2. Keys and Configuration3. Make an endpoint that returns a token4. Create a client app to connect

1. Install Livekit Server SDK

Install the LiveKit SDKs for the server and client:

yarn add livekit-server-sdk

2. Keys and Configuration

Create a new file at development.env and with your API Key and Secret:

export LIVEKIT_API_SECRET=<API Secret hidden>

3. Make an endpoint that returns a token

Create a server that returns a token for a participant to join a room:

import express from 'express';
import { AccessToken } from 'livekit-server-sdk';
const createToken = () => {
// if this room doesn't exist, it'll be automatically created when the first
// client joins
const roomName = 'quickstart-room';
// identifier to be used for participant.
// it's available as LocalParticipant.identity with livekit-client SDK
const participantName = 'quickstart-username';
const at = new AccessToken('api-key', 'secret-key', {
identity: participantName,
at.addGrant({ roomJoin: true, room: roomName });
return at.toJwt();
const app = express();
const port = 3000;
app.get('/getToken', (req, res) => {
app.listen(port, () => {
console.log(`Server listening on port ${port}`)

Run the server:

$ source development.env
$ node server.js

4. Create a client app to connect

Create a client app that fetches a token from the server you just made, then uses it to connect to a LiveKit room:


Chevron IconNext.js
LiveKit logo