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

@pluralize/sdk

v0.12.0

Published

JavaScript SDK for Pluralize — auth, data, billing, files, and server-side token verification.

Readme

@pluralize/sdk

JavaScript SDK for Pluralize — a platform that adds auth, billing, and multi-tenancy to single-user apps.

Three entry points ship in the same package:

| Import | Runs on | What it covers | |---|---|---| | @pluralize/sdk | Browser | auth, db, billing, files — the operations your users perform. | | @pluralize/sdk/react | Browser | Drop-in <PluralizeLogin />, <PluralizeSignup />, <PluralPricing />. Pre-styled, themeable. | | @pluralize/sdk/server | Node.js / Fluid Compute | verifyToken(req) for your backend. No React, no DOM, no side effects at import. |

Install

npm install @pluralize/sdk

Quickstart (client)

import { Pluralize } from '@pluralize/sdk';

const app = Pluralize.init({
  appId: process.env.NEXT_PUBLIC_PLURALIZE_APP_ID!,
  apiKey: process.env.NEXT_PUBLIC_PLURALIZE_API_KEY!,
});

await app.auth.login('[email protected]', 'correct horse battery staple');

// If the app's signup mode is `invite_only` (configured in the dashboard),
// pass the invite token alongside the credentials:
// await app.auth.signup(email, password, { inviteToken: 'inv_abc123…' });

// Tenant viral invites (issue #10, requires `max_tenant_invites > 0` on the
// tenant's plan):
const minted = await app.auth.mintInvite({ note: 'juan' });
console.log(`Share: https://your-app.example/login?invite=${minted.token}`);
const { tokens, quota } = await app.auth.listMyInvites();
console.log(`${quota.used} of ${quota.limit} used`);

const sub = await app.billing.getSubscription();
const canExport = await app.billing.hasFeature('export_csv');

Quickstart (server)

Verify a Bearer token from your backend before reading your own database:

import { createPluralizeServer } from '@pluralize/sdk/server';

const pluralize = createPluralizeServer({
  appId: process.env.NEXT_PUBLIC_PLURALIZE_APP_ID!,
  apiKey: process.env.NEXT_PUBLIC_PLURALIZE_API_KEY!,
  cookieName: 'pz_token',  // optional: also accept the token from this cookie
});

export async function GET(req: Request) {
  const session = await pluralize.verifyToken(req, {
    include: ['subscription'],  // optional: get plan slug + entitlements in the same hop
  });
  if (!session) return Response.json({ error: 'unauthorized' }, { status: 401 });

  // session.tenantId — scope your own tables with this
  // session.subscription?.planSlug — tier-aware gating
}

Results cache in-memory for 30 s (configurable via cacheSeconds), keyed by the access token, so hot paths pay for a remote introspect only once per cache window.

Auth route handlers (SSR / Next.js)

Skip writing five proxy endpoints by hand. createAuthRouteHandlers returns signup/login/logout/exchange/me handlers that call Pluralize's auth endpoints, manage the pz_token cookie, and return JSON your client SDK can consume. Drop them into your framework's route files:

// app/api/auth/login/route.ts
import { createAuthRouteHandlers } from '@pluralize/sdk/server';

const { login, signup, logout, exchange, me, mintInvite, listMyInvites } =
  createAuthRouteHandlers({
    appId: process.env.PLURALIZE_APP_ID!,
    apiKey: process.env.PLURALIZE_API_KEY!,
    cookieName: 'pz_token',  // matches createPluralizeServer({ cookieName }) above
  });

export const POST = login;  // for signup/exchange/logout
export const GET  = me;     // for /api/auth/me/route.ts

// For tenant viral invites (issue #10), expose mintInvite + listMyInvites
// at e.g. /api/auth/pluralize/invite-tokens (POST + GET on the same path).
// These read pz_token from the cookie jar and forward to Pluralize with
// the proper Bearer header — necessary for SSR/cookie consumers because
// the browser SDK cannot read httpOnly cookies.

The handlers return Web Standard Response objects, so they work in Next.js, Hono, Bun, Cloudflare Workers, or anything else built on the Fetch API.

Docs

Full documentation at pluralize.app/docs:

License

MIT.