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

@copypatch/next

v2.0.0

Published

Next.js App Router and SSR integration package for CopyPatch

Readme

@copypatch/next

Next.js App Router helpers for CopyPatch. It wraps the React client integration, adapts a colocated v2 backend to an App Router catch-all route, and reads published snapshots directly during SSR/RSC.

Install

pnpm add @copypatch/core @copypatch/react @copypatch/backend @copypatch/next

Minimal usage

import { NextCopyPatchProvider, EditableText } from '@copypatch/next';
import { readPublishedSnapshot } from '@copypatch/next/server';
import { backend } from '@/lib/copypatch-backend';

export default async function Page() {
  const snapshot = await readPublishedSnapshot(backend, 'en');

  return (
    <NextCopyPatchProvider
      locale="en"
      initialSnapshot={snapshot}
    >
      <EditableText contentKey="home.hero.title" as="h1">
        Pre-rendered headline
      </EditableText>
    </NextCopyPatchProvider>
  );
}

Create a catch-all route at app/%5F%5Fcopypatch/api/v2/[...path]/route.ts. The percent-encoded folder name is required because Next treats underscore- prefixed source folders as private while the public URL remains /__copypatch/api/v2. The adapter forwards the original Web Request and the backend Response without rebuilding either one:

import { createCopyPatchRouteHandlers } from '@copypatch/next/server';
import { backend } from '@/lib/copypatch-backend';
import { resolveCopyPatchContext } from '@/lib/copypatch-auth';

export const { GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS } =
  createCopyPatchRouteHandlers(backend, {
    resolveContext: resolveCopyPatchContext,
  });

resolveContext(request) returns CopyPatchHandleContext (including an optional opaque hostAuth value and a trusted clientAddress for unsafe request rate limits). It is passed directly to the backend and is never serialized into request headers. readPublishedSnapshot returns the backend result directly; supply { fallback } when the host needs a specific safe snapshot if the read rejects.

Exports

  • @copypatch/next: NextCopyPatchProvider, CopyPatchProvider, EditableText, useCopyPatch, useEditableText, useCopyPatchStore
  • @copypatch/next/server: createCopyPatchRouteHandlers, readPublishedSnapshot

Requirements

  • ESM-only package
  • Node.js >=20
  • Peer dependencies: next, react, and react-dom
  • A configured @copypatch/backend instance in the Next.js server runtime; no localhost URL or self-fetch is required

Links

License

MIT