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

# Next.js example

> A complete server-to-browser integration pattern.

The `digital-human` repository includes a runnable App Router example with:

* A server-only API client.
* Create, refresh, and end session routes.
* A LiveKit prejoin screen.
* A full conference page.
* An embedded digital-human page that omits the local participant tile.

## Recommended structure

```text theme={null}
app/
├── api/session/route.ts
├── api/session/[sessionId]/route.ts
├── full-call/page.tsx
└── embedded-face/page.tsx
```

The create route imports `digital-human/server`. Client components import only
the root types and `digital-human/react`.

## Refresh route

```ts app/api/session/[sessionId]/route.ts theme={null}
import { createDigitalHumanClient } from "digital-human/server";

export async function GET(_request, { params }) {
  const { sessionId } = await params;
  const session = await client.getSession(sessionId);

  if (!session.connection) {
    return Response.json({ message: "Session ended" }, { status: 410 });
  }

  return Response.json(session.connection, {
    headers: { "Cache-Control": "no-store" },
  });
}
```

Protect this route with your application's authentication and session-level
authorization before deploying it.

<Card title="View the SDK repository" icon="github" href="https://github.com/lagena-ai/digital-human">
  Browse the complete example alongside the package source.
</Card>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.