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

@drkaachen/content-sanity

v1.2.1

Published

Optional Sanity content adapter for DRK apps

Downloads

212

Readme

@drkaachen/content-sanity

Optional Sanity integration package for DRK apps.

This package contains:

  • Sanity client setup
  • image URL builder (urlFor)
  • GROQ queries
  • hostname-based site loading (getSiteByHostname)

When to use

Use this package only in apps that actually need Sanity CMS data.

If your app is UI-only, install only @drkaachen/design-system-ui.

Installation

npm install @drkaachen/content-sanity

Exports

import {
  client,
  urlFor,
  getSiteByHostname,
  siteByHostnameQuery,
  pageBySlugQuery,
  blogPostsQuery,
  blogPostBySlugQuery,
  legalPageBySlugQuery,
} from '@drkaachen/content-sanity'

Environment Variables

Required:

  • NEXT_PUBLIC_SANITY_PROJECT_ID

Recommended:

  • NEXT_PUBLIC_SANITY_DATASET (default: production)
  • NEXT_PUBLIC_SANITY_API_VERSION (default: 2024-01-01)
  • NEXT_PUBLIC_DEFAULT_SITE_HOSTNAME (optional fallback hostname)

Typical Usage

import { getSiteByHostname, urlFor } from '@drkaachen/content-sanity'
import type { SiteConfig as UiSiteConfig } from '@drkaachen/design-system-ui'

export async function getUiSite(hostname: string): Promise<UiSiteConfig | null> {
  const cmsSite = await getSiteByHostname(hostname)
  if (!cmsSite) return null

  return {
    _id: cmsSite._id,
    name: cmsSite.name,
    hostname: cmsSite.hostname,
    defaultLocale: cmsSite.defaultLocale,
    logoUrl: cmsSite.logo ? urlFor(cmsSite.logo).height(120).fit('max').auto('format').url() : undefined,
    navigation: cmsSite.navigation,
    footerLinks: cmsSite.footerLinks,
  }
}

Boundaries

  • Keep CMS-specific logic in this package.
  • Do not import this package from @drkaachen/design-system-ui.
  • Keep UI package consumers free from Sanity dependencies unless explicitly needed.

Privacy and Security Notes

  • Store secrets and tokens in environment variables only.
  • Validate all hostnames and request inputs before using them in fetch parameters.
  • Keep CMS integration optional to reduce GDPR/DSGVO risk surface for apps that do not need external content services.

Data Privacy & DSGVO

Using this package means your application makes API requests to Sanity.io servers to fetch content. This has several DSGVO (Datenschutz-Grundverordnung) implications:

  • IP address transmission: Every Sanity API/CDN request transmits the visitor's IP address to Sanity servers. This constitutes personal data processing under DSGVO.
  • Data Processing Agreement (DPA): A Auftragsverarbeitungsvertrag (AVV / DPA) with Sanity.io must be in place before processing any visitor data through their services.
  • International data transfer: Sanity.io is a US-based service. Standard Contractual Clauses (SCCs) for international data transfer must be executed to comply with DSGVO Chapter V requirements.
  • Privacy policy disclosure: Your site's privacy policy (Datenschutzerklärung) must mention Sanity.io as a data processor, the categories of data processed, and the legal basis for the transfer.
  • Public datasets: Sanity public datasets are readable by anyone with the project ID. Never store personal data (e.g. user submissions, contact details) in public datasets.
  • Client-exposed env vars: All NEXT_PUBLIC_ environment variables are embedded in the client-side JavaScript bundle by design. NEXT_PUBLIC_SANITY_PROJECT_ID and NEXT_PUBLIC_SANITY_DATASET will be visible to end users.
  • CDN routing: When useCdn: true is set (the default for production), content requests are routed through Sanity's CDN, which is likely US-hosted. Consider this when evaluating data residency requirements.

Security

  • NEXT_PUBLIC_SANITY_PROJECT_ID is intentionally public. It is required on the client to fetch content and only grants read access to public datasets. This is safe as long as public datasets contain only published content data.
  • Never store sensitive or personal data in public Sanity datasets. Use private datasets with token-based access for any data that should not be publicly accessible.
  • Configure Sanity Studio access controls properly. Restrict editor/admin roles to authorized personnel. Enable two-factor authentication for Sanity accounts. Review the project's CORS origins and API token permissions regularly.