Getting Started
starlight-docsearch-typesense is a Starlight plugin that integrates Typesense
with the DocSearch interface to add lightning-fast, typo-tolerant search to your Starlight documentation site.
It’s a drop-in replacement for Algolia DocSearch, powered by an open-source search engine.
Prerequisites
Section titled “Prerequisites”You’ll need an existing Starlight project. If you don’t have one yet, follow the Getting Started guide to create it.
Installation
Section titled “Installation”-
Install the plugin by running one of the following commands in your terminal:
Terminal window npm install starlight-docsearch-typesenseTerminal window pnpm add starlight-docsearch-typesenseTerminal window yarn add starlight-docsearch-typesenseTerminal window bun i starlight-docsearch-typesense -
Configure the plugin in your Starlight configuration in the
astro.config.mjsfile.astro.config.mjs import starlight from '@astrojs/starlight'import { defineConfig } from 'astro/config'import starlightDocSearchTypesense from 'starlight-docsearch-typesense'export default defineConfig({integrations: [starlight({title: 'My Docs',plugins: [starlightDocSearchTypesense({typesenseCollectionName: 'docs',typesenseServerConfig: {nodes: [{ url: 'http://localhost:8108' }],apiKey: 'xyz',},}),],}),],}) -
Start the development server to preview the plugin in action.
Once your dev server starts, search bar will appear in your site header. If you haven’t indexed your docs yet, it will stay empty until your Typesense collection is set up. To index your docs, either:
- Let the plugin index your site when it builds, see the Built-in Indexing guide.
- Or crawl your deployed site with the Typesense DocSearch Scraper.