vitepress-plugin-moss package. The plugin automatically indexes your content at build time and replaces the default search with a fast, semantic search interface powered by Moss.
Note: For the full plugin source and a demo site, see the vitepress-plugin-moss package.
Why use Moss with VitePress?
VitePress’s built-in search relies on keyword matching, which misses results when users phrase queries differently than the docs. Moss semantic search understands meaning, so users find what they need even when their wording doesn’t match the docs exactly. Queries run in under 10ms once the local index loads.Required tools
Integration guide
1
Installation
- npm
- pnpm
- yarn
2
Environment setup
Create a
.env file in your project root (add it to .gitignore)..env
3
Configure VitePress
Add the Moss plugin and search options to your VitePress config.
docs/.vitepress/config.ts
4
Build and test
When you run
vitepress build, the plugin automatically parses your Markdown, chunks it into semantic segments, and uploads them to Moss. For local development, start the dev server and press Ctrl+K or Cmd+K to test search.How it works
The plugin uses a two-phase search architecture:- Cloud hot-path — From the first keystroke, queries route to Moss cloud for instant results.
- Local WebAssembly — In the background, the local model and index download in parallel. Once ready, queries switch to sub-10ms on-device search automatically.
Excluding pages
Addsearch: false to a page’s frontmatter to exclude it from the index.
Configuration
Search options
All options go underthemeConfig.search.options in your VitePress config.