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

next-metadata-toolkit

v0.2.0

Published

Thin wrapper around Next.js App Router Metadata API with typed JSON-LD helpers.

Readme

@andesphere/next-seo

Thin, type-safe helpers for the Next.js App Router Metadata API plus JSON-LD utilities.

  • Wraps Next.js Metadata with sensible defaults
  • Preserves global Open Graph/Twitter defaults via deep merge
  • Typed JSON-LD helpers using schema-dts (types only)
  • Zero runtime dependencies

Install

npm install @andesphere/next-seo
# or
pnpm add @andesphere/next-seo
# or
yarn add @andesphere/next-seo

Quick Start

1) Global config (root layout)

// app/layout.tsx
import { createSeoConfig } from '@andesphere/next-seo';

export const metadata = createSeoConfig({
  siteName: 'Andy Partner',
  titleTemplate: '%s | Andy Partner',
  defaultTitle: 'Andy Partner – AI Chatbot for Small Business',
  defaultDescription: 'Custom AI chatbots that help small businesses capture and convert leads.',
  baseUrl: 'https://andypartner.com',
  defaultOgImage: '/og-default.png',
  twitterHandle: '@andypartner',
  locale: 'en_US',
});

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  );
}

2) Per-page metadata

// app/blog/[slug]/page.tsx
import { makePageMetadata } from '@andesphere/next-seo';

export async function generateMetadata({ params }: { params: { slug: string } }) {
  const post = await getPost(params.slug);

  return makePageMetadata({
    title: post.title,
    description: post.excerpt,
    canonical: `/blog/${post.slug}`,
    openGraph: {
      type: 'article',
      images: [{ url: post.coverImage }],
      publishedTime: post.publishedAt,
    },
  });
}

Tip: If you have the pathname but not a canonical URL, you can pass pathname instead:

makePageMetadata({
  title: 'Pricing',
  description: 'Simple pricing for growing teams.',
  pathname: '/pricing',
});

3) JSON-LD

// app/page.tsx
import { JsonLd, organizationSchema, websiteSchema } from '@andesphere/next-seo';

export default function HomePage() {
  return (
    <>
      <JsonLd
        data={organizationSchema({
          name: 'Andy Partner',
          url: 'https://andypartner.com',
          logo: 'https://andypartner.com/logo.png',
          sameAs: [
            'https://twitter.com/andypartner',
            'https://linkedin.com/company/andypartner',
          ],
        })}
      />
      <JsonLd
        data={websiteSchema({
          name: 'Andy Partner',
          url: 'https://andypartner.com',
          searchUrl: 'https://andypartner.com/search?q={search_term_string}',
        })}
      />
      {/* Page content */}
    </>
  );
}
// app/blog/[slug]/page.tsx
import { JsonLd, articleSchema, breadcrumbSchema } from '@andesphere/next-seo';

export default function BlogPost({ post }: { post: Post }) {
  return (
    <>
      <JsonLd
        data={articleSchema({
          headline: post.title,
          description: post.excerpt,
          image: post.coverImage,
          datePublished: post.publishedAt,
          dateModified: post.updatedAt,
          author: { name: post.author.name },
          publisher: {
            name: 'Andy Partner',
            logo: 'https://andypartner.com/logo.png',
          },
        })}
      />
      <JsonLd
        data={breadcrumbSchema([
          { name: 'Home', url: '/' },
          { name: 'Blog', url: '/blog' },
          { name: post.title, url: `/blog/${post.slug}` },
        ])}
      />
      {/* Post content */}
    </>
  );
}

API

createSeoConfig(input)

Builds global defaults for your root layout and stores them for page-level merging.

import type { SeoConfigInput } from '@andesphere/next-seo';

Key options:

  • siteName: Site or brand name (required)
  • titleTemplate: Title template (default: %s | ${siteName})
  • defaultTitle: Default title (default: siteName)
  • defaultDescription: Default meta description
  • baseUrl: Absolute site URL (required). Sets metadataBase
  • defaultOgImage: Default Open Graph/Twitter image (relative or absolute)
  • twitterHandle: @handle for Twitter metadata
  • locale: Open Graph locale (e.g. en_US)

makePageMetadata(input)

Creates page-level metadata and deep-merges Open Graph/Twitter with the global defaults.

Additional fields:

  • canonical: Canonical URL or path (relative ok when metadataBase is set)
  • pathname: Convenience for generating canonical URLs from a path

<JsonLd />

Server Component to render JSON-LD:

<JsonLd data={organizationSchema({ name: 'Example', url: 'https://example.com' })} />

Schema helpers

All helpers return WithContext<T> objects from schema-dts:

  • organizationSchema()
  • websiteSchema() (optional SearchAction)
  • productSchema() (includes Offer)
  • articleSchema()
  • faqPageSchema()
  • breadcrumbSchema()

Notes

  • metadataBase is required for correct absolute URL generation. Always pass baseUrl to createSeoConfig.
  • Open Graph images work best at 1200x630.
  • Next.js merges metadata shallowly. This package deep-merges Open Graph and Twitter for you.
  • For dynamic pages, consider React.cache() to share data between generateMetadata and the page component.
  • FAQ pages typically perform best with ~10 questions or fewer.

License

MIT