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

scolta-next

v1.0.1

Published

Scolta adapter for Next.js — AI-powered Pagefind search (with a gated Payload CMS module)

Readme

scolta-next

Scolta adapter for Next.js — AI-powered Pagefind search, on top of the scolta binding. Ships a gated Payload CMS module (scolta-next/payload).

Content modes

Set source in your config:

  • static-export (default) — for output: 'export' sites. After next build, npx scolta-build crawls the rendered HTML in out/ and writes the index. Search works fully static.

    AI tier in static export: a pure static site has no server, so POST Route Handlers are not included. Search is unaffected; the AI tier (expand/summarize/follow-up) requires an externally hosted endpoint — point window.scolta.endpoints at it — or running the site in server mode. This is a real limitation, documented honestly, not a workaround.

  • content — for server/hybrid sites. Register a content source (an async iterable of ContentItems + a cheap changed-since check so unchanged entries yield CachedContentReference and hit the token cache). CMS-agnostic.

    • Headless Node CMS (Payload): the built first-class module (scolta-next/payload).
    • Decoupled Drupal / JSON:API (next-drupal): the highest-demand case. If the Next site is statically exported, static-export mode already indexes the rendered Drupal content with no Drupal-specific code. For server mode, JsonApiContentSource is a documented worked example (a fetch-based async iterable over a Drupal JSON:API endpoint with a changed-since check).

Configuration

Config options are the shared binding's — the full reference is scolta's CONFIG_REFERENCE.

AI endpoints

Mount the ready-made Route Handlers at the exact paths scolta.js defaults to:

// app/api/scolta/v1/expand-query/route.ts
import { createScoltaRouteHandlers, NextScoltaConfig } from "scolta-next";
const h = createScoltaRouteHandlers(NextScoltaConfig.fromEnv());
export const POST = h.expandQuery;

…and likewise summarize / followup (POST) and health (GET).

Health endpoint

GET /health returns {"status": "ok"|"degraded"} — enough for uptime monitors. The full diagnostic payload (provider, index state, scoring config) is exposed only with healthDetail: true in the adapter config. There is no user model in a headless stack, so detail is config-gated rather than auth-gated; enable it only where the endpoint is not publicly reachable.

Search widget

import { ScoltaSearch } from "scolta-next/component";
<ScoltaSearch config={config.toBrowserConfig()} />

Run npx scolta-build assets once to copy the vendored bundle into public/scolta/; the index is written under public/pagefind/.

CLI

npx scolta-build            # fresh build (postbuild)
npx scolta-build --force    # ignore the token cache
npx scolta-build --resume   # resume an interrupted build
npx scolta-build --restart  # discard transient state
npx scolta-build assets     # copy runtime assets into public/

Auto-rebuild

In content mode, construct a ScoltaTracker and call touch(key) on content changes; it debounces a rebuild that reuses the token cache (gated on autoRebuild):

import { ScoltaTracker } from "scolta-next";

const tracker = new ScoltaTracker(config, { rebuild: () => buildIndex(config, { source }) });
tracker.touch("post:42");

Serverless deployments should trigger rebuilds via webhook/CI instead.