Skip to content

Installation Guide

This guide will walk you through setting up Mixedbread Search in your Astro Starlight documentation site.

Before you begin, you’ll need:

Terminal window
git clone https://github.com/mixedbread-ai/mixedbread-starlight.git
cd mixedbread-starlight
Terminal window
pnpm install

Create a .env file in the project root:

Terminal window
cp .env.example .env

Add your Mixedbread credentials:

MXBAI_API_KEY=your_api_key_here
MXBAI_STORE_ID=your_store_id_here
  1. API Key: Go to Mixedbread Dashboard → API Keys
  2. Store ID: Go to Stores → Select your store → Copy the Store ID

First, update the sync commands in package.json to use your store name:

{
"scripts": {
"docs:sync": "mxbai store sync \"mixedbread-starlight\" \"./src/content/**/*.mdx\" \"./src/content/**/*.md\" --yes --strategy fast",
"docs:sync:dry-run": "mxbai store sync \"mixedbread-starlight\" \"./src/content/**/*.mdx\" \"./src/content/**/*.md\" --dry-run"
}
}

Replace "mixedbread-starlight" with your actual Mixedbread store name (the same one you created and added to your .env file).

Now sync your documentation to Mixedbread store:

Terminal window
pnpm docs:sync

To preview changes before syncing:

Terminal window
pnpm docs:sync:dry-run
Terminal window
pnpm dev

If you want to add Mixedbread Search to an existing Starlight site instead of cloning this repository:

Copy the plugins/starlight-mixedbread directory to your project:

Terminal window
cp -r plugins/starlight-mixedbread your-project/plugins/

Add the required dependencies to your project:

Terminal window
pnpm add @mixedbread/sdk github-slugger remove-markdown
pnpm add -D @mixedbread/cli

Add Astro React integration:

Terminal window
pnpm astro add react

Add your Mixedbread credentials to the .env file:

MXBAI_API_KEY=your_api_key_here
MXBAI_STORE_ID=your_store_id_here

Update your astro.config.mjs:

// @ts-check
import { defineConfig, envField } from 'astro/config';
import starlight from '@astrojs/starlight';
import react from '@astrojs/react';
import { starlightMixedbread } from './plugins/starlight-mixedbread/plugin';
export default defineConfig({
env: {
schema: {
MXBAI_API_KEY: envField.string({ context: 'server', access: 'secret' }),
MXBAI_STORE_ID: envField.string({ context: 'server', access: 'secret' }),
},
},
integrations: [
react(),
starlight({
title: 'Your Docs',
plugins: [
starlightMixedbread({
apiKey: process.env.MXBAI_API_KEY ?? '',
storeId: process.env.MXBAI_STORE_ID ?? '',
maxResults: 8,
}),
],
}),
],
});

Create src/pages/api/search.ts with the search endpoint (copy from this repository’s file).

Add sync commands to your package.json:

{
"scripts": {
"docs:sync": "mxbai store sync \"your-store-name\" \"./src/content/**/*.mdx\" \"./src/content/**/*.md\" --yes --strategy fast",
"docs:sync:dry-run": "mxbai store sync \"your-store-name\" \"./src/content/**/*.mdx\" \"./src/content/**/*.md\" --dry-run"
}
}

Replace "your-store-name" with your actual Mixedbread store name.

Sync your documentation to Mixedbread store:

Terminal window
pnpm docs:sync

To preview changes before syncing:

Terminal window
pnpm docs:sync:dry-run

Start your development server:

Terminal window
pnpm dev

Press ⌘K (Mac) or Ctrl+K (Windows/Linux) to open the search modal and test the search functionality.

You can automate documentation syncing with GitHub Actions. Create .github/workflows/sync-docs.yml:

name: Sync docs to Mixedbread Store
on:
workflow_dispatch:
push:
branches: [main]
paths:
- src/content/**/*.md
- src/content/**/*.mdx
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install Mixedbread CLI
run: npm i -g @mixedbread/cli
- name: Sync store
shell: bash
env:
MXBAI_API_KEY: ${{ secrets.MXBAI_API_KEY }}
MXBAI_STORE_ID: ${{ secrets.MXBAI_STORE_ID }}
run: mxbai store sync "${MXBAI_STORE_ID}" "./src/content/**/*.mdx" "./src/content/**/*.md" --yes --strategy fast

Add MXBAI_API_KEY and MXBAI_STORE_ID to your GitHub repository secrets (Settings → Secrets and variables → Actions).

If your Astro project is in a subdirectory (e.g., monorepo), use working-directory for the sync step:

name: Sync docs to Mixedbread Store
on:
workflow_dispatch:
push:
branches: [main]
paths:
- docs/src/content/**/*.md # Trigger when docs change
- docs/src/content/**/*.mdx
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install Mixedbread CLI
run: npm i -g @mixedbread/cli
- name: Sync store
working-directory: ./docs # Set working directory to docs folder
shell: bash
env:
MXBAI_API_KEY: ${{ secrets.MXBAI_API_KEY }}
MXBAI_STORE_ID: ${{ secrets.MXBAI_STORE_ID }}
run: mxbai store sync "${MXBAI_STORE_ID}" "./src/content/**/*.mdx" "./src/content/**/*.md" --yes --strategy fast

The working-directory ensures the CLI runs from the correct subdirectory.

  1. Check API credentials: Verify MXBAI_API_KEY and MXBAI_STORE_ID are set
  2. Check Store ID: Double-check your store identifier
  3. Sync your content: Run pnpm docs:sync to upload your documentation
  4. Verify build: Run pnpm check for type errors

Make sure:

  • The plugin is properly configured in astro.config.mjs
  • React integration is enabled
  • No other components override the Search component
  • MXBAI_API_KEY and MXBAI_STORE_ID are set with correct API key and Store ID
  • You’ve synced your docs with pnpm docs:sync