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

@paperhand/typescript

v0.1.7

Published

Official TypeScript SDK for the Paperhand VM provisioning API.

Readme

@paperhand/typescript

Official TypeScript SDK for Paperhand — provision ephemeral VMs over a simple REST API.

Install

npm install @paperhand/typescript

Requires Node.js 18+ (uses the global fetch).

Quickstart

import { createClient } from "@paperhand/typescript";

const ph = createClient({ apiKey: process.env.PAPERHAND_API_KEY });

// Provision a VM.
const vm = await ph.vms.create({ vcpu: 4, memory: "8GB" });

// Run a command inside it.
const test = await vm.exec({ command: "npm test" });
console.log(test.stdout);

// Tear it down.
await vm.destroy();

Authentication

Every request is authenticated with a workspace API key sent as Authorization: Bearer <apiKey>.

To get a key:

  1. Open the Paperhand dashboard.
  2. Go to Workspace settings.
  3. Open the API keys tab.
  4. Click Generate key.

Keys are prefixed with ph_. Store the key in the PAPERHAND_API_KEY environment variable:

export PAPERHAND_API_KEY="ph_..."

If you don't pass apiKey explicitly, the client falls back to process.env.PAPERHAND_API_KEY and throws if it is missing.

API

createClient(options)

  • options.apiKey — workspace API key. Defaults to PAPERHAND_API_KEY.
  • options.baseUrl — API base URL. Defaults to https://api.paperhand.io.

client.vms.create(options)Promise<Vm>

Provision a VM.

| Option | Type | Default | Notes | | ------------- | ---------- | --------------- | ------------------------------------------------------------------------------------------------------------------------- | | vcpu | number | — | Required. Sent as vCPU. | | memory | string | — | Required, e.g. "8GB". | | storage | string | "4GB" | | | type | string | "linux/amd64" | | | region | VmRegion | — | One of VmRegionus-east, us-west, apac, ew-east, eu-central, hong-kong, africa-south, mainland-china. | | idleTimeout | number | — | Seconds of inactivity before stop. | | description | string | — | | | template | string | — | Reserved; not yet sent to the API. |

Vm

  • vm.id — the provisioned instanceId.
  • vm.exec({ command })Promise<{ stdout, stderr, instance }>.
  • vm.pause()Promise<{ instance }>.
  • vm.destroy()Promise<{ instance }>.

client.shelves.create(options)Promise<Shelf>

Create a shelf in the API key's workspace. The slug is auto-generated from the name (letters, numbers, spaces, and underscores) and is unique within the workspace.

| Option | Type | Default | Notes | | --------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------- | | name | string | — | Required. Letters, numbers, spaces, and underscores. | | privacy | "private" \| "public" \| "restricted" | "private" | private: only you. public: everyone in the workspace. restricted: you + userIds. | | userIds | string[] | — | Workspace user ids granted access. Only used when privacy is restricted. |

const shelf = await ph.shelves.create({
  name: "reports",
  privacy: "restricted",
  userIds: ["user_123", "user_456"],
});
console.log(shelf.id, shelf.slug); // → "…", "reports"

client.shelves.get(idOrSlug)Promise<ShelfDetails>

Fetch a shelf by its id or slug. Throws PaperhandError (status 404) when the shelf doesn't exist or isn't visible to the key's workspace.

const shelf = await ph.shelves.get("reports"); // by slug
// or: await ph.shelves.get("k17abc...")        // by id
console.log(shelf.name, shelf.privacy, shelf.createdAt);

client.shelves.updatePrivacy(idOrSlug, options)Promise<void>

Change a shelf's privacy, addressing it by id or slug. Only the shelf's owner may do this. Throws PaperhandError (status 404) when the shelf doesn't exist or isn't visible to the key's workspace.

| Field | Type | Description | | --------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | privacy | "private" \| "public" \| "restricted" | The new visibility. | | userIds | string[] | Workspace user ids granted access. Only used when privacy is restricted (replaces the shelf's members). |

await ph.shelves.updatePrivacy("reports", {
  privacy: "restricted",
  userIds: ["usr_1", "usr_2"],
});

Shelf

  • shelf.id — the created shelfId.
  • shelf.slug — the auto-generated slug.

ShelfDetails

Returned by shelves.get: { id, name, slug, privacy, createdAt } (createdAt is epoch milliseconds).

Errors

Any non-2xx response throws a PaperhandError with status (HTTP code) and message (the server's error field when present).

import { PaperhandError } from "@paperhand/typescript";

try {
  await ph.vms.create({ vcpu: 4, memory: "8GB" });
} catch (err) {
  if (err instanceof PaperhandError) {
    console.error(err.status, err.message);
  }
}