npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cloudflare-ai-search-sync

v0.2.0

Published

Synchronize Markdown files to Cloudflare AI Search automatically.

Readme

cloudflare-ai-search-sync

npm version npm downloads License pkg.pr.new

Synchronize Markdown and Nuxt Content with Cloudflare AI Search. Read Bringing Cloudflare AI Search to Docus and VitePress for the story behind the package family.

  • Index Markdown from Vite, VitePress 2, or Nuxt Content.
  • Resolve public URLs from each framework's routing configuration.
  • Keep Cloudflare's built-in source in sync with the completed local snapshot.
  • Configure the metadata used by the Cloudflare AI Search snippet.

Installation

pnpm add cloudflare-ai-search-sync

Usage

The adapters are disabled by default. Enable synchronization with enabled: true or CLOUDFLARE_AI_SEARCH_SYNC_ENABLED=true. An explicit option takes precedence over the environment variable.

VitePress

Use the native VitePress 2 buildEnd hook:

// .vitepress/config.ts
import { cloudflareAISearchSync } from 'cloudflare-ai-search-sync/vitepress'
import { defineConfig } from 'vitepress'

export default defineConfig({
  buildEnd: cloudflareAISearchSync({ enabled: true }),
})

The adapter resolves base, rewrites, and cleanUrls before uploading each page.

Nuxt Content

Register the Nuxt module after Nuxt Content:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    '@nuxt/content',
    'cloudflare-ai-search-sync/nuxt',
  ],
  cloudflareAISearchSync: { enabled: true },
})

The module runs during nuxt build and nuxt generate, never during nuxt dev. It indexes published Markdown documents from Nuxt Content page collections and excludes documents with draft: true, including drafts stored in meta.

Vite filesystem

Synchronize a folder of Markdown files after successful Vite builds:

// vite.config.ts
import { cloudflareAISearchSync } from 'cloudflare-ai-search-sync/fs'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    cloudflareAISearchSync({
      enabled: true,
      folder: './docs',
    }),
  ],
})

Relative folders resolve from the Vite project root. Set cleanUrls: true to omit .html from non-index routes.

Custom integrations

The root export provides synchronizeItems, syncItems, ensureItemMetadata, toPublicUrl, siteRoot, isSyncEnabled, and getCloudflareClient for custom content sources.

Cloudflare setup

Provide the following build-only environment variables:

CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_API_TOKEN=
CLOUDFLARE_AI_SEARCH_INSTANCE_ID=
CLOUDFLARE_AI_SEARCH_NAMESPACE=
CLOUDFLARE_AI_SEARCH_SYNC_ENABLED=true

The API token needs Account / AI Search:Edit and Account / AI Search:Run permissions. Never expose these credentials through Vite client configuration, Nuxt public runtime configuration, or a browser bundle.

Vite loads variables from its resolved mode and environment directory. VitePress loads production variables from the site root. Nuxt reads the build process environment. Explicit adapter options take precedence in every integration.

The adapters upload the complete local snapshot before deleting stale items from the AI Search builtin source. This includes manually uploaded built-in items. An empty snapshot therefore deletes all built-in items.

Related packages

Sponsors

License

MIT License © 2026-PRESENT Estéban Soubiran