MCPcopy Index your code
hub / github.com/algolia/docsearch

github.com/algolia/docsearch @v4.6.3 sqlite

repository ↗ · DeepWiki ↗ · release v4.6.3 ↗
430 symbols 996 edges 239 files 11 documented · 3%
README

DocSearch

The easiest way to add search to your documentation – for free.

Netlify Status npm version Used by License

DocumentationJavaScript PlaygroundReact Playground


DocSearch crawls your documentation, pushes the content to an Algolia index and provides a dropdown search experience on your website.

Preview

Ask AI demo

Usage

Don't have your Algolia credentials yet? Apply to DocSearch!

JavaScript

Installation

yarn add @docsearch/js@4
# or
npm install @docsearch/js@4

If you don’t want to use a package manager, you can use a standalone endpoint:

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@4"></script>

Get started

To get started, you need a container for your DocSearch component to go in. If you don’t have one already, you can insert one into your markup:






Then, insert DocSearch into it by calling the docsearch function and providing the container. It can be a CSS selector or an Element.

Make sure to provide a container (for example, a div), not an input. DocSearch generates a fully accessible search box for you.

```js app.js import docsearch from '@docsearch/js';

import '@docsearch/css';

docsearch({ container: '#docsearch', appId: 'YOUR_APP_ID', indexName: 'YOUR_INDEX_NAME', apiKey: 'YOUR_SEARCH_API_KEY', });


### React

#### Installation

```bash
yarn add @docsearch/react@4
# or
npm install @docsearch/react@4

If you don’t want to use a package manager, you can use a standalone endpoint:

<script src="https://cdn.jsdelivr.net/npm/@docsearch/react@4"></script>

Get started

DocSearch generates a fully accessible search box for you.

```jsx App.js import { DocSearch } from '@docsearch/react';

import '@docsearch/css';

function App() { return ( ); }

export default App; ```

Styling

Read documentation →

Related projects

DocSearch is made of the following repositories:

Used by

DocSearch is used by Bootstrap, Cheerio, Element Plus, Authelia, MDX, VitePress and many more.

Used by Generated with usedby.dev

License

MIT

Extension points exported contracts — how you extend this code

SidepanelInstance (Interface)
(no doc)
packages/docsearch-sidepanel-js/src/sidepanel.tsx
DocSearchInstance (Interface)
(no doc)
packages/docsearch-js/src/docsearch.tsx
UseTrapFocusProps (Interface)
(no doc)
packages/docsearch-react/src/useTrapFocus.ts
DocSearchModalShortcuts (Interface)
(no doc)
packages/docsearch-core/src/useKeyboardShortcuts.ts
DocSearchPropsLite (Interface)
(no doc)
adapters/docusaurus-theme-search-algolia/src/client/useAlgoliaAskAi.ts
Chainable (Interface)
(no doc)
cypress/support/commands.d.ts
Window (Interface)
(no doc)
examples/demo-js/src/main.ts
SidepanelCallbacks (Interface)
(no doc)
packages/docsearch-sidepanel-js/src/sidepanel.tsx

Core symbols most depended-on inside this repo

isAskAiPromptBlockingError
called by 17
packages/docsearch-react/src/utils/ai.ts
isThreadDepthError
called by 14
packages/docsearch-react/src/utils/ai.ts
getBundleBanner
called by 11
packages/docsearch-css/build-css.js
useDocSearch
called by 10
packages/docsearch-core/src/DocSearch.tsx
mergeFacetFilters
called by 10
adapters/docusaurus-theme-search-algolia/src/client/utils.ts
showAskAiBlockingBannerNewConversationLink
called by 9
packages/docsearch-react/src/utils/ai.ts
extractAgentStudioErrorFieldMessage
called by 9
packages/docsearch-react/src/utils/ai.ts
useDocSearchKeyboardEvents
called by 9
packages/docsearch-core/src/useDocSearchKeyboardEvents.ts

Shape

Function 367
Interface 56
Method 7

Languages

TypeScript100%

Modules by API surface

packages/docsearch-react/src/utils/ai.ts17 symbols
packages/docsearch-react/src/AskAiScreen.tsx17 symbols
packages/docsearch-js/src/docsearch.tsx15 symbols
packages/docsearch-react/src/utils/askAiBlockingMatchers.ts13 symbols
packages/docsearch-react/src/DocSearchModal.tsx13 symbols
adapters/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx13 symbols
packages/docsearch-sidepanel-js/src/sidepanel.tsx12 symbols
packages/docsearch-react/src/utils/storage.ts10 symbols
packages/docsearch-core/src/DocSearch.tsx10 symbols
packages/docsearch-react/src/Sidepanel/Sidepanel.tsx9 symbols
adapters/docusaurus-theme-search-algolia/src/theme/SearchPage/index.tsx9 symbols
packages/docsearch-react/src/stored-searches.ts8 symbols

Dependencies from manifests, versioned

@ai-sdk/react2.0.30 · 1×
@algolia/autocomplete-core1.19.2 · 1×
@babel/plugin-transform-react-jsx7.25.9 · 1×
@babel/preset-env7.26.0 · 1×
@babel/preset-typescript7.26.0 · 1×
@docsearch/core4.6.3 · 1×
@docsearch/cssworkspace:* · 1×
@docsearch/docusaurus-adapterworkspace:* · 1×
@docsearch/js4.6.0 · 1×
@docsearch/modalworkspace:* · 1×
@docsearch/react4.6.3 · 1×
@docsearch/sidepanelworkspace:* · 1×

For agents

$ claude mcp add docsearch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact