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

@extract.design/sdk

v0.1.0

Published

Official Node.js SDK for the extract.design API - Extract print-ready designs from product photos

Downloads

16

Readme

extract-design

Official Node.js SDK for the extract.design API.

Extract print-ready designs from product photos with AI. Perfect for POD automation, e-commerce tools, and Etsy/Shopify integrations.

Installation

npm install @extract.design/sdk

Quick Start

import { ExtractDesign } from '@extract.design/sdk';

const client = new ExtractDesign({ apiKey: 'sk_live_...' });

// Extract and wait for result
const result = await client.extractAndWait({
  imageUrl: 'https://example.com/product-mockup.jpg',
});

console.log(result.extractionUrl); // URL to transparent PNG

Usage

Basic Extraction

import { ExtractDesign } from '@extract.design/sdk';

const client = new ExtractDesign({ apiKey: process.env.EXTRACT_DESIGN_API_KEY });

// Submit extraction
const { extractionId } = await client.extract({
  imageUrl: 'https://example.com/mug-with-design.jpg',
});

// Check status
const status = await client.getExtraction(extractionId);
console.log(status.status); // 'pending' | 'processing' | 'completed' | 'failed'

// Wait for completion
const result = await client.waitForCompletion(extractionId);
console.log(result.extractionUrl);

With Options

const result = await client.extractAndWait({
  imageUrl: 'https://example.com/product.jpg',
  scale: 4,           // Upscale 4x
  faceEnhance: true,  // Enhance faces
  preset: 'normal',   // Processing preset
});

Remix (Transform Design)

const result = await client.extractAndWait({
  imageUrl: 'https://example.com/lemon-design-mug.jpg',
  remixPrompt: 'Make it a watermelon',
});

console.log(result.extractionUrl); // Original extracted design
console.log(result.remixUrl);      // Remixed design

With Webhook

// Pro, Premium, and Ultra plans only
const { extractionId } = await client.extract({
  imageUrl: 'https://example.com/product.jpg',
  webhookUrl: 'https://your-api.com/webhook',
  metadata: { orderId: '12345' },
});

// Your webhook will receive:
// {
//   "extraction_id": "...",
//   "status": "completed",
//   "extraction_url": "...",
//   "metadata": { "orderId": "12345" }
// }

Base64 Image

import { readFileSync } from 'fs';

const imageBuffer = readFileSync('./product.jpg');
const base64 = imageBuffer.toString('base64');

const result = await client.extractAndWait({
  imageBase64: base64,
});

Progress Callback

const result = await client.waitForCompletion(extractionId, {
  timeout: 300000,  // 5 minutes
  interval: 3000,   // Check every 3 seconds
  onProgress: (status) => {
    console.log(`Status: ${status.status}`);
    if (status.estimatedSecondsRemaining) {
      console.log(`ETA: ${status.estimatedSecondsRemaining}s`);
    }
  },
});

Check Usage

const usage = await client.getUsage();
console.log(`Credits remaining: ${usage.credits.total}`);
console.log(`Plan: ${usage.plan}`);

Verify API Key

try {
  await client.verifyApiKey();
  console.log('API key is valid');
} catch (error) {
  console.log('Invalid API key');
}

Error Handling

import {
  ExtractDesign,
  AuthenticationError,
  InsufficientCreditsError,
  ValidationError,
  RateLimitError,
  TimeoutError,
  ExtractionFailedError,
} from '@extract.design/sdk';

try {
  const result = await client.extractAndWait({
    imageUrl: 'https://example.com/product.jpg',
  });
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.log('Invalid API key');
  } else if (error instanceof InsufficientCreditsError) {
    console.log('Not enough credits');
  } else if (error instanceof ValidationError) {
    console.log('Invalid request:', error.errorMessage);
  } else if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry after ${error.retryAfter}s`);
  } else if (error instanceof TimeoutError) {
    console.log(`Extraction ${error.extractionId} timed out`);
  } else if (error instanceof ExtractionFailedError) {
    console.log(`Extraction failed: ${error.reason}`);
  } else {
    throw error;
  }
}

Configuration

const client = new ExtractDesign({
  apiKey: 'sk_live_...',
  baseUrl: 'https://extract.design', // Optional
  timeout: 30000,                     // Request timeout in ms
});

TypeScript

Full TypeScript support with exported types:

import type {
  ExtractOptions,
  ExtractResponse,
  ExtractionResult,
  ExtractionStatus,
  UsageResponse,
  Credits,
} from '@extract.design/sdk';

API Reference

ExtractDesign

extract(options): Promise<ExtractResponse>

Submit an image for extraction.

getExtraction(id): Promise<ExtractionResult>

Get the status and result of an extraction.

waitForCompletion(id, options?): Promise<ExtractionResult>

Poll until extraction completes.

extractAndWait(options, waitOptions?): Promise<ExtractionResult>

Submit and wait for completion in one call.

getUsage(): Promise<UsageResponse>

Get account usage and credit balance.

verifyApiKey(): Promise<boolean>

Verify the API key is valid.

Links

License

MIT