Skip to content

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.

You’ll need an existing Starlight project. If you don’t have one yet, follow the Getting Started guide to create it.

  1. Install the plugin by running one of the following commands in your terminal:

    Terminal window
    npm install starlight-docsearch-typesense
  2. Configure the plugin in your Starlight configuration in the astro.config.mjs file.

    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',
    },
    }),
    ],
    }),
    ],
    })
  3. 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. See the Typesense DocSearch Scraper guide on how to set up your index.