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

@moonsio/next-schema

v0.16.0

Published

A comprehensive Schema.org JSON‑LD solution for React/Next.js apps. Strongly typed, composable schemas, and a single `SchemaJson` component that outputs a valid `<script type="application/ld+json">` tag.

Readme

@moonsio/next-schema

A comprehensive Schema.org JSON‑LD solution for React/Next.js apps. Strongly typed, composable schemas, and a single SchemaJson component that outputs a valid <script type="application/ld+json"> tag.

Features

  • TypeScript-first: rich types for all supported entities
  • Composable: supply only the entities you need; we build a single @graph
  • Stable IDs: IDs are generated consistently using a configurable base URL
  • Next.js ready: safe to use in App Router or Pages Router (SSR compatible)
  • React 18 and 19: published with peer ranges ^18 || ^19

Installation

pnpm add @moonsio/next-schema
# or
npm i @moonsio/next-schema

Peer dependencies you must have in your app:

{
  "peerDependencies": {
    "react": "^18 || ^19",
    "react-dom": "^18 || ^19"
  }
}

Quick start

  1. Configure the base URL once at app startup (used to build stable @ids):
// e.g. app/layout.tsx or pages/_app.tsx
import { setBaseUrl } from '@moonsio/next-schema'

setBaseUrl('https://example.com')
  1. Render SchemaJson on any page. Only pass what you need; we will include the matching entities in @graph.
import { SchemaJson } from '@moonsio/next-schema'

export default function HomePage() {
  return (
    <SchemaJson
      logo={{
        image: { srcUrl: 'https://example.com/logo.png', width: 512, height: 512 },
        url: 'https://example.com'
      }}
      website={{ baseUrl: 'https://example.com', companyName: 'Example Inc.' }}
      webpage={{ name: 'Home', description: 'Welcome', slug: '' }}
    />
  )
}

Supported entities

Pass any of the following props to SchemaJson; if provided, a corresponding node will be added to @graph:

  • address
  • article
  • breadcrumb
  • book
  • dataset
  • educationalOrganization
  • event
  • faqPage
  • howTo
  • logo (recommended)
  • medicalCondition
  • medicalOrganization
  • movie
  • newsArticle
  • organization
  • person
  • place
  • product
  • restaurant
  • softwareApplication
  • videoObject
  • webpage (recommended)
  • website (recommended)

Examples

Article

<SchemaJson
  logo={{ image:{ srcUrl:'/logo.png', width:512, height:512 }, url:'https://example.com' }}
  website={{ baseUrl:'https://example.com', companyName:'Example Inc.' }}
  webpage={{ name:'My Article', description:'...', slug:'blog/my-article' }}
  article={{
    headline: 'My Article',
    articleTitle: 'My Article',
    description: 'Short description',
    slug: 'blog/my-article',
    author: 'Person',
    datePublished: new Date(),
  }}
/>

Product

<SchemaJson
  logo={{ image:{ srcUrl:'/logo.png', width:512, height:512 }, url:'https://example.com' }}
  website={{ baseUrl:'https://example.com', companyName:'Example Inc.' }}
  webpage={{ name:'Product', description:'...', slug:'products/widget' }}
  product={{
    name: 'Widget',
    description: 'A great widget',
    sku: 'WID-001',
    offers: { price: 19.99, priceCurrency: 'USD' },
    url: 'products/widget'
  }}
/>

Event (virtual or physical)

<SchemaJson
  logo={{ image:{ srcUrl:'/logo.png', width:512, height:512 }, url:'https://example.com' }}
  website={{ baseUrl:'https://example.com', companyName:'Example Inc.' }}
  webpage={{ name:'Event', description:'...', slug:'events/launch' }}
  event={{
    name: 'Launch Event',
    description: 'Product launch',
    startDate: '2025-01-01T18:00:00Z',
    endDate: '2025-01-01T20:00:00Z',
    location: { url: 'https://example.com/live' }, // VirtualLocation
    url: 'events/launch'
  }}
/>

API

Components

  • SchemaJson(props: SchemaJsonProps)
    • Emits a single <script type="application/ld+json"> tag containing {"@context":"https://schema.org","@graph":[...]}
    • Only includes entities for the props you supply

Configuration

  • setBaseUrl(url: string) – must be called before using generators; used to build stable @ids and urls

Types

SchemaJsonProps exposes all optional entity props listed above. You can rely on editor IntelliSense without importing individual schema types.

Next.js integration

  • App Router: render SchemaJson in app/(segment)/page.tsx or app/layout.tsx
  • Pages Router: render in page components or in _document.tsx inside <Head>
  • The component uses dangerouslySetInnerHTML with serialized JSON; it’s SSR‑safe

Troubleshooting

  • “Base URL is not set. Use setBaseUrl to configure it.”
    • Call setBaseUrl('https://your-domain') once at app startup (layout or _app)
  • Nothing renders
    • Ensure you pass at least logo and website/webpage props; others are optional

Versioning & compatibility

  • Peer deps: react and react-dom ^18 || ^19
  • Target: modern Node/Next.js (ESNext output)

Contributing / Development

pnpm install
pnpm build
pnpm test

# Create a changeset for releases
pnpm changeset

Releases are automated via GitHub Actions + Changesets. See .github/workflows/release.yml.

License

MIT