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

@foundrykit/guides-plugin

v0.2.2

Published

CMS guides for Payload 3 client sites: a Guides page, Help buttons on edit pages and local search, synced read-only from the Umi guides hub, with site-specific guides written in place by Umi staff.

Readme

@foundrykit/guides-plugin

CMS guides for Payload 3 client sites, served from the Umi guides hub.

  • Guides page at /admin/guides (linked in the sidebar): browse by topic, search, read.
  • Help button on every edit page, listing the guides for that collection or global. Renders nothing when there are none.
  • <Help context="…" /> for finer places, e.g. media.create.
  • Local read-only copy of the guides this site is entitled to, so help works when the hub is down. The hub pushes a signed ping on every change; a scheduled pull is the backstop.
  • Site guides: Umi staff write guides for this site only. Publishing saves them straight to the hub (scoped to this site); if the hub can't be reached the editor shows an error and the draft is kept.

Extracted from the Turquoise CMS guides section. Spec: https://claude.ai/artifact/RXzSKWXUPBH1K5Gu77CzbJ

Install

import { guidesPlugin } from '@foundrykit/guides-plugin';

export default buildConfig({
  plugins: [
    guidesPlugin({
      // Reported to the hub on each sync, to compare with the site's Sites record.
      features: ['crm.inspiretec'],
      // Who can write site guides here. Default: nobody.
      canAuthor: user =>
        (user as { role?: string } | null)?.role === 'super-admin',
    }),
  ],
});

Environment (from the site's record in the hub):

GUIDES_HUB_URL=https://guides.example.com
GUIDES_HUB_KEY=<the site's guides key>

Then regenerate the import map (payload generate:importmap) and create a migration: the plugin adds the guides and site-guides collections and a guidesSync job task.

Options

| Option | Default | | | ---------------- | ---------------------------- | --------------------------------------------------------------------------------------- | | hubURL | process.env.GUIDES_HUB_URL | The guides hub. | | siteKey | process.env.GUIDES_HUB_KEY | This site's guides key. Also verifies the hub's webhook signature. | | features | [] | Feature keys reported to the hub. | | plugins | [] | Extra FoundryKit plugins to report as active (see below). | | canAuthor | () => false | Who sees and writes Site guides. | | schedule | '0 0 * * * *' (hourly) | Cron for the backstop pull (Payload's 6-field form), or false. | | guidesSlug | 'guides' | Slug of the local copy of the hub's guides. Change it if the site has its own guides. | | siteGuidesSlug | 'site-guides' | Slug of the Site guides collection. | | disabled | false | |

Changing the slugs

For a site that already has a guides (or site-guides) collection, pick other slugs, e.g. guidesPlugin({ guidesSlug: 'cms-guides', siteGuidesSlug: 'cms-site-guides' }). The Guides page stays at /admin/guides. Then:

  • Create a migration as usual; the tables follow the slugs. Changing the slugs on a site that already has the plugin installed renames the collections, so that migration drops the old tables; the local copy refills from the hub, but unpublished site-guide drafts would need copying across first.
  • The webhook moves to /api/<guidesSlug>/sync. The hub sends pings to /api/guides/sync, so until it can be told otherwise, such a site updates through the scheduled pull (and on first boot) only.
  • Pass the slug to any Help you place yourself: clientProps: { context: 'media.create', guidesSlug: 'cms-guides' }. The plugin's own Help buttons get it automatically.

Plugin guides

The hub sends a site the guides for each FoundryKit plugin it runs. Every FoundryKit Payload plugin records its npm name in config.custom.foundrykit.activePlugins when it is enabled (installed-but-disabled doesn't count), and this plugin reports that list on every pull. Plugin order in plugins: [...] doesn't matter: the list is read from the running config. Add a plugin to the plugins option only if its version predates self-reporting.

The scheduled pull

The plugin registers a guidesSync task scheduled on the default queue. Payload only runs schedules when something runs the jobs: jobs.autoRun on a long-running server, or a cron hitting /api/payload-jobs/run on serverless (e.g. a Vercel cron). Without either, the site still updates on every hub ping and on first boot when the local copy is empty.

Help in other places

Add the client component wherever an admin component path is accepted:

{ path: '@foundrykit/guides-plugin/client#Help', clientProps: { context: 'media.create' } }

A guide shows there when its help contexts (set in the hub, or on a site guide) include that key.

How it talks to the hub

| | | | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Pull | GET <hub>/api/sites/feed?pluginVersion=…&features=…&plugins=… with Authorization: sites API-Key <key> | | Ping | The hub POSTs to /api/guides/sync (/api/<guidesSlug>/sync) with x-guides-signature: sha256=<HMAC of the body, keyed with the site key>. Anything else gets 401. | | Site guides | Publish → POST/PATCH <hub>/api/guides[/:id]; delete → DELETE. |

Development

pnpm install
pnpm dev           # dev app on :3000 (set GUIDES_HUB_URL / GUIDES_HUB_KEY to point at a hub)
pnpm test          # unit + integration (SQLite in memory, hub stubbed)
pnpm build

Releasing

Run pnpm release on prod. It bumps the version, updates the changelog and pushes a v* tag. The tag triggers .github/workflows/publish.yml, which publishes to npm through trusted publishing, so no npm token is stored locally or in GitHub.