Mintlify assistant embed example
Working example of embedding the Mintlify assistant widget into a Vite app
README
Mintlify assistant embed example
Working examples of embedding the Mintlify assistant widget: one using Vite, one using Next.js. Each demonstrates how to integrate the assistant via the API.
See Tutorial: Build an in-app documentation assistant for step-by-step instructions to embed and customize the widget.
Choose an example
| Framework | Directory | Dev server |
|---|---|---|
| Vite | vite/ |
http://localhost:5173 |
| Next.js | nextjs/ |
http://localhost:3000 |
Setup (either example)
-
Pick a directory and install dependencies:
cd vite # or cd nextjs npm install -
Add your API token in that directory:
- Vite: Copy
vite/.env.exampletovite/.env. SetVITE_MINTLIFY_TOKEN=... - Next.js: Copy
nextjs/.env.exampletonextjs/.env.local. SetNEXT_PUBLIC_MINTLIFY_TOKEN=...
Both
VITE_andNEXT_PUBLIC_prefixed variables are bundled into client-side code and visible in the browser. The Mintlify assistant token is designed for client-side use. - Vite: Copy
-
Set your project in config: Edit
src/config.jsinside that directory. Setdomain(your Mintlify project slug) anddocsURL(your docs site URL). -
Run the dev server:
npm run devThen open the URL shown in the terminal.
AI SDK version
Both examples use Vercel AI SDK v4. If you move to AI SDK v5, the useChat API and message types change; see the AI SDK migration guide.
Repo structure
vite/ # Vite + React example
nextjs/ # Next.js App Router example
Each directory is a full app with its own package.json, config, and src/. Use one at a time from its directory.
