LiveKit embed · Next.js

LiveKit embed — Next.js

Runnable in repo

This is the hello-world integration. Fork it, run locally, and drop the same embed into your product shell.

Run locally

From the repo root, ./start runs all examples (or ./start sveltekit / ./start nextjs / ./start react-vite for those frameworks). To run only this one:

terminal
cd examples/livekit-embed/nextjs
npm install
npm run dev
# http://localhost:4009

Local URL: http://localhost:4009

Experience id

The demo uses a single public experience id (exp_01EXAMPLES_COFFEE_BARISTA) written directly in the page.

Liforma integration

Use a client component and import Experience from @liforma/client/react (not /next):

embed
'use client';

import { Experience } from '@liforma/client/react';

export function Demo() {
  return <Experience experienceId="exp_01EXAMPLES_COFFEE_BARISTA" />;
}

Key files

  • lib/helloByo.tscopy into your productstartByoSpeech (thin SDK call)
  • app/DemoApp.tsx — demo scaffolding only (Connect / Start UI)
  • app/api/livekit-token/route.ts — demo token mint

Related docs

AI agent prompt

Use the Liforma LiveKit embed Next.js App Router example as source material.

Source repo folder: examples/livekit-embed/nextjs

Copy `helloByo.ts` (`startByoSpeech` → `connectLiveKitAgent`) into your product — that is the integration.
`DemoApp.tsx` is demo scaffolding only.

Preserve:
- `<Experience />` from `@liforma/client/react` in presenter mode with `speechInputMode="off"`
- `'use client'` on the Experience mount component
- import from `@liforma/client/react` (not `/next` — that export is the session-route helper)
- `startByoSpeech(experience, { url, token })` after audio unlock (thin wrapper over `connectLiveKitAgent`)
- participant token minted on a server route / Vite middleware (never ship LIVEKIT_API_SECRET to browsers)
- peer dependency `livekit-client`
- TypeScript and normal CSS (no Tailwind)

Adapt:
- branding
- experience id
- LiveKit room / agent
- production token-mint backend