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

@templatefox/sdk

v1.10.0

Published

Official TemplateFox TypeScript SDK - Generate PDFs from HTML templates

Readme

TemplateFox TypeScript SDK

Official TypeScript/Node.js SDK for TemplateFox - Generate PDFs from HTML templates via API.

npm version License: MIT

Installation

npm install @templatefox/sdk

Or with yarn:

yarn add @templatefox/sdk

Quick Start

import { Configuration, PDFApi, CreatePdfRequest } from '@templatefox/sdk';

// Initialize the client
const config = new Configuration({
  apiKey: 'your-api-key',
});

const api = new PDFApi(config);

// Generate a PDF
async function generatePdf() {
  const response = await api.createPdf({
    templateId: 'YOUR_TEMPLATE_ID',
    data: {
      name: 'John Doe',
      invoiceNumber: 'INV-001',
      totalAmount: 150.00,
    },
  });

  console.log('PDF URL:', response.url);
  console.log('Credits remaining:', response.creditsRemaining);
}

generatePdf();

Features

  • Template-based PDF generation - Create templates with dynamic variables, generate PDFs with your data
  • Multiple export options - Get a signed URL (default) or raw binary PDF
  • S3 integration - Upload generated PDFs directly to your own S3-compatible storage
  • TypeScript support - Full type definitions included

API Methods

PDF Generation

// Generate PDF and get URL
const response = await api.createPdf({
  templateId: 'TEMPLATE_ID',
  data: { name: 'John Doe' },
  exportType: 'url',        // 'url' or 'binary'
  expiration: 86400,        // URL expiration in seconds (default: 24h)
  filename: 'invoice-001',  // Custom filename
});

Templates

import { TemplatesApi } from '@templatefox/sdk';

const templatesApi = new TemplatesApi(config);

// List all templates
const templates = await templatesApi.listTemplates();

// Get template fields
const fields = await templatesApi.getTemplateFields({ templateId: 'TEMPLATE_ID' });

Account

import { AccountApi } from '@templatefox/sdk';

const accountApi = new AccountApi(config);

// Get account info
const account = await accountApi.getAccount();
console.log('Credits:', account.credits);

// List transactions
const transactions = await accountApi.listTransactions({ limit: 100, offset: 0 });

S3 Integration

import { IntegrationsApi } from '@templatefox/sdk';

const integrationsApi = new IntegrationsApi(config);

// Save S3 configuration
await integrationsApi.saveS3Config({
  s3ConfigRequest: {
    endpointUrl: 'https://s3.amazonaws.com',
    accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
    secretAccessKey: 'your-secret-key',
    bucketName: 'my-pdf-bucket',
    defaultPrefix: 'generated/pdfs/',
  }
});

// Test connection
const test = await integrationsApi.testS3Connection();
console.log('Connection:', test.success ? 'OK' : 'Failed');

Configuration Options

const config = new Configuration({
  basePath: 'https://api.templatefox.com', // Default API URL
  apiKey: 'your-api-key',
});

// Or use environment variable
const config = new Configuration({
  apiKey: process.env.TEMPLATEFOX_API_KEY,
});

Error Handling

try {
  const response = await api.createPdf({ /* ... */ });
} catch (error) {
  if (error.status === 402) {
    console.error('Insufficient credits');
  } else if (error.status === 403) {
    console.error('Access denied - check your API key');
  } else if (error.status === 404) {
    console.error('Template not found');
  } else {
    console.error('Error:', error.message);
  }
}

Documentation

Support

License

MIT License - see LICENSE for details.