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

@revstackhq/next

v0.6.0

Published

<div align="center"> <h1>@revstackhq/next</h1> <p>The Next.js 15 App Router SDK for Revstack.</p> </div>

Readme

This package enforces strict Server/Client boundaries for Next.js 15 App Router applications, allowing you to gate access securely on the server and re-export safe hooks for your client components.

Key Features

  • Strict Boundaries: Subpath exports (/server and /client) prevent "useState cannot be used in a Server Component" errors.
  • Auto-Identity Resolution: Reads async headers() to extract guest fingerprints and Auth JWTs automatically.
  • Server-Side Gating: Securely verify entitlements before rendering structural UI.
  • Zero Webhooks: Because Revstack Cloud acts as the source of truth, you just read entitlements.

Installation

npm install @revstackhq/next @revstackhq/react @revstackhq/browser

Overview

Client Components

We re-export the React hooks securely from the /client subpath. Add "use client" and use them directly:

// app/components/ClientPaywall.tsx
"use client";

import { useEntitlement } from "@revstackhq/next/client";

export function ClientPaywall() {
  const { hasAccess } = useEntitlement("generative_ai");
  if (!hasAccess) return <UpgradePrompt />;
  return <AI Workspace />;
}

React Server Components (RSC)

Gate pages, layouts, or Server Actions using the /server utilities. Identity is extracted automatically from incoming request headers.

// app/dashboard/page.tsx
import { requireEntitlement } from "@revstackhq/next/server";

export default async function DashboardPage() {
  // 1. Automatically throws or redirects if the user lacks access
  const entitlement = await requireEntitlement("pro_dashboard", {
    secretKey: process.env.REVSTACK_SECRET_KEY!,
    redirectTo: "/pricing", // Auto-redirect via Next.js navigation
  });

  // 2. Safely render the protected route
  return (
    <main>
      <h1>Pro Dashboard</h1>
      <p>Data limit: {entitlement.value}</p>
    </main>
  );
}

API Reference (@revstackhq/next/server)

getEntitlement(key, config)

Asynchronously resolves a single entitlement for the current user (identified via headers). Does not throw on denial.

requireEntitlement(key, config)

Verifies access. If denied, it calls redirect(config.redirectTo) (if provided) or throws a generic Error.

withMetering(key, amount, config, handler)

A Higher-Order Function to wrap Next.js App Router API Routes (route.ts). Intercepts requests to deduct metered limits before executing the developer's route handler. Returns a 402 Payment Required response if credits are fully consumed.