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

productcraft

v1.4.8

Published

All-in-one Node.js / TypeScript SDK for the ProductCraft platform — Auth, Mail, Waitlist, Social, Platform-Auth, Trawl, Flags and Notify from a single import. Install per-product packages (`@productcraft/auth`, ...) if you only need one.

Readme

productcraft

All-in-one Node.js / TypeScript SDK for the ProductCraft platform: Auth, Mail, Waitlist, Social, Trawl, Flags, Notify and Platform from one import, one key and one shared config.

npm install productcraft

Node 20.3 or later, Bun, Deno and edge runtimes.

Upgrading from 0.3? See the 1.0 migration guide.

When to use this

Install productcraft when one backend calls more than one ProductCraft product (for example it signs users in with Auth and sends email with Mail). Install a per-product package when you only need one; the classes are identical:

Quick start

import { ProductCraft } from "productcraft";

// The key falls back to PRODUCTCRAFT_API_KEY, the workspace to PRODUCTCRAFT_WORKSPACE_ID.
const pc = new ProductCraft({
  apiKey: process.env.PRODUCTCRAFT_API_KEY,
  workspaceId: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
});

// Mail: an Idempotency-Key is generated for you, so a retry never sends twice.
await pc.mail.emails.send({
  from: "Acme <[email protected]>",
  to: "[email protected]",
  subject: "Welcome",
  html: "<p>Thanks for signing up.</p>",
});

// Waitlist and Trawl: list calls auto-paginate with for await.
for await (const list of pc.waitlist.lists.list()) console.log(list.id, list.slug);
const job = await pc.trawl.jobs.create({
  description: "The product title on each page",
  json_schema: { type: "object", properties: { title: { type: "string" } }, required: ["title"] },
});
console.log(job.id, job.status);

// Auth: sign an end user in to one of your apps, then verify their token offline.
const session = await pc.auth.consumer("my-app").signin({ identifier: "[email protected]", password: "…" });
if (session.result === "session") {
  const claims = await pc.auth.verifyToken(session.access_token, { app: "my-app" });
  console.log(claims.sub);
}

pc.auth, pc.mail, pc.waitlist, pc.social, pc.trawl, pc.flags, pc.notify and pc.platform (also reachable as pc.platformAuth, its 0.x name) are the same classes the per-product packages export, each built on first access, so an app that only uses pc.mail never constructs the others. pc.flags is the Flags management client (projects, flags, targeting, SDK keys); to evaluate flags in your app, use FlagsClient from @productcraft/flags with an SDK key. Each product's README lists its resources and methods.

Configuration

Everything you pass is shared by every product:

import { ProductCraft } from "productcraft";

const pc = new ProductCraft({
  apiKey: "pcft_live_…",             // or auth: { type: "bearer", token } / { type: "cookie", value }
  workspaceId: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
  maxRetries: 3,                    // default 2: network errors, 408, 429 and 5xx, honouring Retry-After
  timeout: 20_000,                  // per attempt, default 60 s
  logLevel: "warn",                 // or "debug"; PRODUCTCRAFT_LOG also works
  defaultHeaders: { "x-trace-id": "checkout-42" },
  overrides: {
    // Per product, merged over the shared settings (nested, because `auth` is the credential key).
    mail: { timeout: 5_000 },
    auth: { baseUrl: "https://api.auth.example.test" },
  },
});

workspaceId is optional with a workspace API key: without it the SDK looks it up once per process from the key and every product shares that one lookup. Pass it, or set PRODUCTCRAFT_WORKSPACE_ID, to skip the extra request. Bearer and cookie credentials can span workspaces and must pass it.

Credentials from the environment are a server-only fallback. Never put a key in NEXT_PUBLIC_* or another variable a bundler inlines into browser code; a workspace key in a browser throws unless you set dangerouslyAllowBrowser: true. Auth's consumer routes (pc.auth.consumer(slug)) never pick up PRODUCTCRAFT_API_KEY.

Errors and types

Every error class is exported, and instanceof works across products:

import { ProductCraft, NotFoundError, RateLimitError, APIError, type Mail } from "productcraft";

const pc = new ProductCraft();
try {
  await pc.mail.domains.retrieve("0b8a3f9e-5d1c-4e2a-9f6b-7c3d2e1a0f4b");
} catch (err) {
  if (err instanceof NotFoundError) console.log("no such domain", err.requestId);
  else if (err instanceof RateLimitError) console.log("retry in", err.retryAfter, "s");
  else if (err instanceof APIError) console.log(err.status, err.code, err.docUrl);
  else throw err;
}

// Each product's type namespace: Mail.Domain, Trawl.Job, Waitlist.Entry, …
const status: Mail.DomainStatus = "active";

verifyWebhook (Standard Webhooks signatures) is exported too; each product also has webhooks.unwrap() with typed events.

Escape hatch

pc.<product>.client is the typed openapi-fetch client over the same credential and base URL (it does not retry), for anything you want to call by path.

How it is built

Every product is generated from its API's live OpenAPI document by scripts/gen-sdk.mjs over one shared runtime, @productcraft/core. The contract is docs/sdk-standard.md.

License

MIT.