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

stackmachine

v0.3.0

Published

JavaScript SDK for deploying and managing apps on StackMachine.

Readme

stackmachine

JavaScript SDK for deploying and managing apps on StackMachine.

Functionality

  • Deploy apps
  • Fetch app information
  • Fetch app logs
  • Delete apps
  • Manage app domains
  • Manage app volumes
  • ...

Installation

npm install stackmachine

The examples in this repository use the STACKMACHINE_API_KEY environment variable:

export STACKMACHINE_API_KEY=your_api_key_here

Basic Usage

Initialize the client:

import StackMachine from "stackmachine";

const client = new StackMachine(process.env.STACKMACHINE_API_KEY);

Named imports and CommonJS are also supported:

import { StackMachine } from "stackmachine";

const client = new StackMachine(process.env.STACKMACHINE_API_KEY);
const StackMachine = require("stackmachine");

const client = StackMachine(process.env.STACKMACHINE_API_KEY);

StackMachine.init({ apiKey, apiUrl }) is still supported for existing code. Pass constructor config such as apiUrl, timeout, or maxNetworkRetries only when you need to override the defaults.

Use the resource clients for app and file operations:

const deployment = await client.deployments.create(
  {
    appName: "hello-stackmachine",
    owner: "stackmachine",
    files: {
      "index.html": "<html><body><h1>Hello StackMachine</h1></body></html>",
    },
  },
  {
    onUploadProgress: ({ percent }) => {
      console.log("Uploading", percent * 100, "%");
    },
  },
);
const appVersion = await deployment.wait({
  onProgress: ({ datetime, stream, kind, message }) => {
    console.log(datetime, stream, kind, message);
  },
});
const app = await client.apps.retrieve(appVersion.app.id);

For manual package uploads, use the lower-level file client:

import StackMachine, { createZip } from "stackmachine";

const client = new StackMachine(process.env.STACKMACHINE_API_KEY);
const zip = await createZip({
  "index.html": "<html><body><h1>Hello StackMachine</h1></body></html>",
});
const uploadUrl = await client.files.upload(zip, {
  onProgress: ({ percent }) => {
    console.log("Uploading", percent * 100, "%");
  },
});
const deployment = await client.deployments.create({
  appName: "hello-stackmachine",
  owner: "stackmachine",
  uploadUrl,
});

Resources with retrieve(...) also expose retrieveMany(...), preserving input order and returning null for missing IDs:

const [firstApp, missingApp, secondApp] = await client.apps.retrieveMany([
  firstAppId,
  missingAppId,
  secondAppId,
]);

client.apps.autobuild(...) is still supported as a deprecated compatibility alias for client.deployments.create(...); its returned deployment still supports the old .finish() and .subscribeToProgress(...) methods.

Resume an existing deployment by build ID:

const deployment = await client.deployments.retrieve(buildId);
const appVersion = await deployment.wait();

List APIs return Stripe-style paginated list objects:

const apps = await client.apps.list({ limit: 10 });
console.log(apps.data);

for await (const app of client.apps.list({ limit: 25 })) {
  console.log(app.name, app.url);
}

const domains = await client.apps.domains
  .list({ app: app.id, limit: 25 })
  .autoPagingToArray({ limit: 100 });

Manage app volumes:

const volume = await client.apps.volumes.create({
  app: app.id,
  mountPath: "/data",
  maxSizeBytes: 1_073_741_824,
});

const volumes = await client.apps.volumes
  .list({ app: app.id, limit: 25 })
  .autoPagingToArray({ limit: 100 });

const updated = await client.apps.volumes.update(volume.id, {
  mountPath: "/uploads",
  s3Enabled: true,
});

await client.apps.volumes.del(updated.id);

Check out the examples below for more client usage.

Examples

Example scripts live in examples/ and can be run with Node after installing the stackmachine dependency.

Develop

Install dependencies with npm install.

Run the test suite with npm test. The tests use Node's built-in node:test runner. Live integration coverage runs when both STACKMACHINE_API_KEY and STACKMACHINE_URL are set; otherwise that integration test is skipped.

Load environment variables from an env file before running tests:

set -a
source .env
npm test

To test against another environment file, source that file instead, for example:

set -a
source .env-bugt
npm test

Run npm run ci before pushing changes. This runs the same validation steps as CI:

  • formatting check
  • type checking
  • build
  • check-schema to verify schema.graphql is up to date

Use npm run format to apply Prettier formatting locally.