Replace Docus default search with Cloudflare AI Search
Replace the default Docus search with Cloudflare AI Search. Read Bringing Cloudflare AI Search to Docus and VitePress for the story behind the package family.
AppSearch component.pnpm add docus-cloudflare-ai-search
Add the module after Docus and provide the public AI Search endpoint root:
// nuxt.config.ts
export default defineNuxtConfig({
extends: ['docus'],
modules: ['docus-cloudflare-ai-search'],
aiSearch: {
client: {
enabled: true,
endpoint: 'https://search.example.com',
},
},
})
When enabled, the module registers a Docus AppSearch replacement. Disable it or omit enabled to retain Docus’s default search. An app/components/AppSearch.vue in your application can still override the module component.
The endpoint is required when the client is enabled. Use the public Cloudflare AI Search endpoint root without /search; the module appends that path to browser requests.
export default defineNuxtConfig({
aiSearch: {
ui: {
placeholder: 'Search documentation',
messages: {
empty: 'No results found.',
error: 'Search is temporarily unavailable. Please try again.',
rateLimit: 'Too many searches. Please try again shortly.',
recent: 'Recent AI searches',
},
},
client: {
enabled: true,
endpoint: 'https://search.example.com',
debounceMs: 200,
query: {
minLength: 2,
maxLength: 200,
},
request: {
timeoutMs: 8_000,
retrievalOptions: {
max_num_results: 10,
},
},
},
},
})
| Option | Description |
|---|---|
client.enabled |
Enables the Docus AppSearch override. Defaults to false. |
client.endpoint |
Required when enabled. Public Cloudflare AI Search endpoint root. |
client.debounceMs |
Delay before sending a search request. Defaults to 200. |
client.query.minLength, client.query.maxLength |
Browser query-length limits. Overlong queries are truncated. |
client.request.timeoutMs |
Browser request timeout in milliseconds. |
client.request.retrievalOptions |
Public retrieval and reranking options sent as ai_search_options. Defaults to { max_num_results: 10 }. |
ui.placeholder |
Command-palette input placeholder. |
ui.messages |
Labels for empty, failed, rate-limited, and recent search states. |
[!WARNING]
The endpoint and every client option are sent to the browser. Never include API tokens,Authorizationvalues, Cloudflare Access service-token secrets, or other credentials.
Create an AI Search instance, enable its public /search endpoint, and add your development and production origins to its authorized hosts. Index only content that is safe to expose publicly.
Use cloudflare-ai-search-sync to index Nuxt Content during builds.
MIT License © 2026-PRESENT Estéban Soubiran