A Next.js starter template for building AI documentation chatbot using AI SDK and Mixedbread Search.
mxbai-docs-chat-demo.mp4
- Bun (or Node.js 22+)
- Git
git clone https://github.com/mixedbread-ai/mxbai-docs-chat
cd mxbai-docs-chatbun installCreate a .env file in the root directory:
cp .env.example .envAdd your credentials to the .env file:
MXBAI_API_KEY=your-api-key-here
MXBAI_STORE_ID=your-store-id
GEMINI_API_KEY=your-api-key-here
GITHUB_TOKEN=your-github-token-hereTo get your API key and Store ID, you have two options:
-
From Vercel Integration (Recommended if deploying to Vercel):
- Go to your Vercel dashboard
- Navigate to your project's Integrations tab
- Install or access the Mixedbread integration
- Copy your API key and Store ID from the integration settings
-
From Mixedbread Platform (For standalone use):
- Visit the Mixedbread Platform
- Sign up or log in to your account
- Navigate to API Keys and create a new key
- Navigate to Stores and create a new Store, then copy the Store ID
This script fetches the Next.js documentation from GitHub and uploads it to your Mixedbread Store for semantic search:
bun ingest-docsNote: If you're on the free plan, your Store has a limit of 100 files. The Next.js documentation exceeds this limit, so not all files will be ingested. The docs chat will not know about files that were not ingested and won't be able to answer questions related to those topics. Consider upgrading your plan or using your own smaller documentation set.
Note: By default, this ingests Next.js documentation from the official repository. See the Customization section below to index your own documentation.
Start the development server:
bun devTo index your own documentation instead of Next.js docs, modify scripts/ingest-docs.ts:
- Change the repository settings:
const REPO_OWNER = "your-org";
const REPO_NAME = "your-repo";
const REPO_BRANCH = "main"; // or your default branch
const DOCS_PATH = "docs"; // path to your docs folder-
Update the source URL construction in the
constructSourceUrl()function to match your documentation site structure. -
Adjust file extensions if needed:
const VALID_EXTENSIONS = [".md", ".mdx"]; // add other formats if needed- Run the ingestion script:
bun ingest-docsIf want to upload your local documentation files, you can use the Mixedbread CLI to upload them directly to your Store.
Edit app/api/chat/route.ts to customize:
- System Prompt: Modify the
SYSTEM_PROMPTconstant to change the LLM's behavior and instructions - Model: Change the
modelvariable if you want to use a different LLM
- Mixedbread Documentation - Learn about Mixedbread's features and APIs
- Quickstart Guide - Get started with creating Stores and uploading files
- Mixedbread Discord - Join the community and get support
This project is licensed under the MIT License.