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

@keystone-sites/core

v1.0.2

Published

Keystone Sites Core - server-side API client, consumer session helpers, and Next.js API route handlers for customer websites

Readme

@keystone-sites/core

Backend middleware for Keystone customer websites — no UI. Supplies the typed server-side API client, consumer session helpers, server actions, CTA URL resolution, and Next.js API route handler factories used by every customer site (legacy or generated).

Package exports

| Import path | Contents | |---|---| | @keystone-sites/core | Server actions (submitContactFormAction, submitLeadFormAction), resolveCtaUrls, resolvePortalPath, isExternalCtaUrl | | @keystone-sites/core/lib/server-api | All server-side data fetching functions (getCompanyInformation, getServices, getAdsConfig, getAnalyticsConfig, …) | | @keystone-sites/core/lib/server-log | Structured server-side logging (serverLog, serverWarn, serverError) | | @keystone-sites/core/lib/cta-urls | resolveCtaUrls, resolvePortalPath, isExternalCtaUrl | | @keystone-sites/core/lib/consumer-session | Consumer auth cookie constant + API helpers (fetchConsumerMe, fetchConsumerConversations, fetchConsumerMessages) | | @keystone-sites/core/lib/actions | Server actions for form submissions | | @keystone-sites/core/next/routes/form | createFormRouteHandlers | | @keystone-sites/core/next/routes/chat | createChatRouteHandlers | | @keystone-sites/core/next/routes/consumer-auth | createConsumerAuthHandlers | | @keystone-sites/core/next/routes/proxy-headers | clientContextHeaders | | @keystone-sites/core/types | Shared TypeScript types for Keystone API responses |

Source directory structure

src/
├── lib/
│   ├── server-api.ts       # Server-side API fetch helpers
│   ├── server-log.ts       # Structured server-side logging
│   ├── consumer-session.ts # Consumer auth cookie + API helpers
│   ├── actions.ts          # Server actions for form submissions
│   └── cta-urls.ts         # CTA URL resolution utilities
├── next/
│   └── routes/             # API route handler factories (form, chat, consumer-auth, proxy-headers)
└── types/
    └── api/                # Keystone API response types

Environment variables

Both this package and customer sites use two server-side environment variables:

| Variable | Required | Default | Description | |---|---|---|---| | API_URL | Yes | http://localhost:3000/api/v1 | Base URL for the Keystone API | | API_KEY | Yes | "" | Service account API key for this site |

These are read at SSR time only and never exposed to the browser. Set them in .env.local for local development.

Publishing workflow

Publish to the public npm registry in dependency order (wait for each package to propagate before publishing dependents):

# 1. @keystone-sites/core (no internal Keystone deps)
npm run test && npm publish --access public

# 2. @keystone-sites/services (depends on @keystone-sites/core)
npm run test && npm publish --access public

# 3. @keystone-sites/widgets (depends on @keystone-sites/core + @keystone-sites/services)
npm run test && npm publish --access public

prepublishOnly runs npm run build automatically before each publish.

For local development against an unpublished build, use yalc:

# In @keystone-sites/core — build and publish to local yalc store
npm run build && yalc publish

# In the customer site — link to the local build
yalc add @keystone-sites/core
# or update an existing link
yalc update @keystone-sites/core

To restore the published npm version:

yalc remove @keystone-sites/core
npm install

Docs