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

@prompty-tools/core

v0.1.1

Published

Typed TypeScript client for the prompty.tools public HTTP API.

Downloads

193

Readme

@prompty-tools/core

Typed TypeScript client for the prompty.tools public HTTP API.

  • Zero runtime dependencies
  • Full TypeScript types for every endpoint
  • Works in Node 20+, modern browsers, Deno, Bun, and edge runtimes (Cloudflare Workers, Vercel Edge)
  • Dual ESM + CJS publish

Installation

npm install @prompty-tools/core

Quickstart

import { createPromptyClient } from "@prompty-tools/core";

const client = createPromptyClient({ apiKey: process.env.PROMPTY_API_KEY! });

const page = await client.prompts.list({ scope: "public", pageSize: 12 });
console.log(page.items.length, "of", page.total);

const prompt = await client.prompts.get(page.items[0].id);
console.log(prompt.title, prompt.compiledPrompt);

Authentication

Generate an API key in your Prompty dashboard. Keys start with pk_ and are passed to the client at construction time:

const client = createPromptyClient({
  apiKey: process.env.PROMPTY_API_KEY!,
});

The key is required and validated synchronously - a missing or malformed key throws PromptyConfigError immediately.

Namespaces

The client exposes one namespace per resource:

| Namespace | Covers | | ---------------------- | ----------------------------------------------------------- | | client.prompts | Prompts (versioned) - list, get, create, update, versions | | client.personas | Personas (versioned) | | client.tones | Tones | | client.outputs | Outputs | | client.constraints | Constraints | | client.collections | Collections (groups of tones and constraints) |

All resources support .list(), .get(id), .create(input), .update(id, input), .delete(id), .vote(id, 1 | -1), .unvote(id), .toggleFavorite(id). Prompts and personas additionally support .setVisibility(id, isPublic), .listVersions(id), and .getVersion(id, versionId).

Error handling

Every non-2xx response throws a typed error:

import {
  PromptyRateLimitError,
  PromptyNotFoundError,
  PromptyAuthError,
} from "@prompty-tools/core";

try {
  await client.prompts.get("prompt_missing");
} catch (err) {
  if (err instanceof PromptyNotFoundError) {
    console.log("not found");
  } else if (err instanceof PromptyRateLimitError) {
    console.log("rate limited");
  } else if (err instanceof PromptyAuthError) {
    console.log("bad API key");
  } else {
    throw err;
  }
}

Pagination

list() returns a Page<T> with navigation helpers:

let page = await client.prompts.list({ scope: "public", pageSize: 24 });
while (page.hasNext) {
  page = await page.next();
  console.log(page.items.map((p) => p.title));
}

Or use the async iterator to walk every page:

for await (const prompt of client.prompts.listAll({ scope: "mine" })) {
  console.log(prompt.title);
}

Bring your own fetch

Inject a custom fetch for Cloudflare Workers, Deno, Bun, or tracing:

const client = createPromptyClient({
  apiKey: process.env.PROMPTY_API_KEY!,
  fetch: (input, init) => tracedFetch(input, init),
});

Runtime support

  • Node.js 20+
  • Modern browsers (any that implement fetch)
  • Deno
  • Bun
  • Cloudflare Workers, Vercel Edge, and other edge runtimes

License

MIT - prompty.tools