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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pressmatic

v1.1.0

Published

Your friendly helper for building print-on-demand apps

Readme

Pressmatic Printify Client

Your friendly helper for building print-on-demand apps

Installation

To install the package, run:

npm install pressmatic
pnpm add pressmatic
bun add pressmatic

Usage

Configuration

First, you need to configure the client with your Printify API key and endpoint:

import { PressmaticClient, PressmaticConfig } from "pressmatic";

const config: PressmaticConfig = {
  apiKey: "your-api-key",
  endpoint: "https://api.printify.com/v1",
};

const client = new PressmaticClient(config);

Product Methods

Get Products

Get a paginated list of products:

const products = await client.getProducts("shopId", { page: 1, limit: 10 });
console.log(products);

Get Product

Get details of a single product:

const product = await client.getProduct("shopId", "productId");
console.log(product);

Publish Product

Publish a product to your store:

await client.publishProduct("shopId", "productId");
console.log("Product published");

Set Publishing Succeeded

Mark a product as successfully published:

await client.setPublishingSucceeded(
  "shopId",
  "productId",
  "product-handle",
  "external-id"
);
console.log("Publishing status updated");

Order Methods

Create Order

Create a new order:

const orderData = {
  id: "orderId",
  address_to: {
    first_name: "John",
    last_name: "Doe",
    email: "[email protected]",
    country: "US",
    address1: "123 Main St",
    city: "New York",
    zip: "10001",
  },
  line_items: [
    {
      product_id: "productId",
      variant_id: 1,
      quantity: 2,
    },
  ],
  shipping_method: 1,
  send_shipping_notification: true,
  status: "pending",
  created_at: new Date().toISOString(),
  updated_at: new Date().toISOString(),
};

const order = await client.createOrder("shopId", orderData);
console.log(order);

Create Order with Product ID

Create a new order with a product ID:

const order = await client.createOrderWithProductId(
  "shopId",
  "external-order-id",
  "Order Label",
  [
    {
      product_id: "productId",
      variant_id: 1,
      quantity: 2,
    },
  ],
  1, // shipping method
  {
    first_name: "John",
    last_name: "Doe",
    email: "[email protected]",
    country: "US",
    address1: "123 Main St",
    city: "New York",
    zip: "10001",
  },
  false, // isPrintifyExpress
  false, // isEconomyShipping
  true // sendShippingNotification
);
console.log(order);

Create Order with SKU

Create a new order with SKU:

const order = await client.createOrderWithSKU(
  "shopId",
  "external-order-id",
  "Order Label",
  [
    {
      sku: "product-sku",
      quantity: 2,
    },
  ],
  1, // shipping method
  {
    first_name: "John",
    last_name: "Doe",
    email: "[email protected]",
    country: "US",
    address1: "123 Main St",
    city: "New York",
    zip: "10001",
  }
);
console.log(order);

Get Order Details

Get details of an existing order:

const orderDetails = await client.getOrderDetails("shopId", "orderId");
console.log(orderDetails);

Update Order

Update an existing order:

const updatedOrder = await client.updateOrder("shopId", "orderId", {
  status: "completed",
});
console.log(updatedOrder);

Delete Order

Delete an order:

await client.deleteOrder("shopId", "orderId");
console.log("Order deleted");

Shipping Methods

Get Shipping Options

Get shipping options for a product:

const shippingOptions = await client.getShippingOptions("shopId", "productId");
console.log(shippingOptions);

Get Shipping Cost

Get the shipping cost for a order:

const shippingCost = await client.getShippingCost(
  "shopId",
  [
    {
      product_id: "productId",
      variant_id: 1,
      quantity: 2,
    },
  ],
  {
    first_name: "John",
    last_name: "Doe",
    email: "[email protected]",
    country: "US",
    address1: "123 Main St",
    city: "New York",
    zip: "10001",
  }
);
console.log(shippingCost);

Error Handling

The client uses a central request handler with error management. If an error occurs, it throws a PrintifyError:

try {
  const products = await client.getProducts("shopId");
} catch (error) {
  if (error instanceof PrintifyError) {
    console.error(`Error: ${error.message}, Status Code: ${error.statusCode}`);
  } else {
    console.error("Unknown error occurred");
  }
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Acknowledgements

Special thanks to the Printify team for their API.

Author

This package is maintained by 10d3.