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

@cmssy/next

v16.2.0

Published

Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)

Readme

@cmssy/next

Next.js (App Router) bindings for a cmssy headless site. One catch-all route renders your published cmssy content with local block components, with live edit-mode preview built in. Pairs with @cmssy/react (blocks + data).

pnpm add @cmssy/next @cmssy/react

Render every page

// app/[[...path]]/page.tsx
import { createCmssyPage } from "@cmssy/next";
import { cmssy } from "@/cmssy/config";
import { blocks } from "@/cmssy/blocks";
import { CmssyEditor } from "@/cmssy/editor";

export default createCmssyPage(cmssy, blocks, { editor: CmssyEditor });
// cmssy/config.ts
import { defineCmssyConfig } from "@cmssy/next";

// defineCmssyConfig validates the required env vars and throws a clear error if
// any is missing - never mask them with `?? ""` (an empty org/slug builds a
// broken delivery URL like `/public//graphql`).
export const cmssy = defineCmssyConfig({
  org: process.env.CMSSY_ORG_SLUG,
  workspaceSlug: process.env.CMSSY_WORKSPACE_SLUG,
  draftSecret: process.env.CMSSY_DRAFT_SECRET, // edit-mode preview handshake
  // apiUrl + editorOrigin default to cmssy cloud; set them only for self-host/staging.
  // Locales come from the workspace site config - no need to repeat them here.
});

createCmssyPage fetches the page for the request path and renders it. In edit mode (draft cookie or ?cmssyEdit=1) it renders your editor instead and frames the live-edit bridge. A published build does not require editorOrigin.

Draft preview

// app/api/draft/route.ts
import { createDraftRoute } from "@cmssy/next/server";
export const GET = createDraftRoute(cmssy);

Cache, and expire it on publish

// app/[[...path]]/page.tsx
export const revalidate = 3600;
const cache = { revalidate };
export default createCmssyPage(cmssy, blocks, { editor: CmssyEditor, cache });

// app/api/revalidate/route.ts
import { createCmssyRevalidateRoute } from "@cmssy/next/server";
export const POST = createCmssyRevalidateRoute({
  secret: process.env.CMSSY_WEBHOOK_SECRET,
});

cache puts the SDK's published reads into the Next data cache under the cmssy-content tag; the route expires that tag for a verified content.changed webhook. Draft mode and the editor always read live.

Edit-mode CSP

import { cmssyCspHeaders, applyCmssyCsp } from "@cmssy/next";

Helpers to frame the page inside the cmssy editor only in edit mode.

Localized navigation (path prefix)

The active locale lives in the URL path prefix (/en/about; the default locale stays bare). createCmssyPage resolves it and exposes it via CmssyLocaleProvider. For the locale to survive navigation, internal links must carry the prefix - prefix hrefs yourself with localizeHref and pass the result to next/link:

// any block component
import Link from "next/link";
import { localizeHref } from "@cmssy/next";

<Link href={localizeHref("/about", locale)}>About</Link>; // → /en/about while EN is active

Add middleware so the root layout (which can't read the path) resolves the right locale from the path prefix. On Next.js 16 the file is proxy.ts (the renamed middleware convention); on Next.js 15 use middleware.ts with the same body.

// proxy.ts (Next.js 16) — or middleware.ts on Next.js 15
import { createCmssyLocaleMiddleware } from "@cmssy/next";
import { cmssy } from "@/cmssy/config";

export const proxy = createCmssyLocaleMiddleware(cmssy);
export const config = { matcher: ["/((?!_next/|api/|.*\\..*).*)"] };

On Next.js 15, name the file middleware.ts and rename the export to middleware (export const middleware = createCmssyLocaleMiddleware(cmssy)).

localizeHref(href, locale) and the CMSSY_LOCALE_HEADER constant are re-exported from @cmssy/next (and @cmssy/core).

Exports

@cmssy/next/server: createCmssyPage, createCmssyEditPage, createDraftRoute, createCmssyRevalidateRoute, CmssyLayoutSlot, resolveCmssyLayout, isCmssyEditMode. @cmssy/next/middleware: createCmssyProxy, cmssyEditRewrite, applyCmssyCsp, isCmssyEditRequest. Root: defineCmssyConfig, localizeHref, nextRetryMode, cmssyCachedFetch, CMSSY_CONTENT_TAG and the types. The full list, with signatures, is in docs/reference/sdk-api.md.

License

MIT