cmdk-static-fulltext-search
Installation
SKILL.md
CMDK Static Full-Text Search Pattern
This pattern implements a global Cmd+K command menu that can search across massive amounts of Markdown/MDX content instantly without paying for a database or serverless execution costs.
When to Use
- When a project requires a global search feature.
- When the content is file-system based (MDX, Markdown) or fetched from a headless CMS at build time.
- When you want to avoid third-party search tools like Algolia.
- When you need full-text search (searching the raw body text) rather than just title/URL matching.
Implementation Details
1. Static API Route (src/app/api/search/route.ts)
Instead of fetching data on every keypress or paying for serverless execution, we force Next.js to bake our entire content payload into a static JSON edge-cached file at build time.