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

@doclinth/sdk

v0.2.0

Published

Official Node/TypeScript SDK for the doclinth PDF generation API.

Readme

@doclinth/sdk

Official Node/TypeScript SDK for the Doclinth PDF generation API. Zero dependencies, fully typed, with automatic retries.

Install

npm install @doclinth/sdk

Requires Node 18+ (uses the global fetch). On older runtimes pass your own fetch via options.fetch.

Usage

import { Doclinth } from "@doclinth/sdk";

const doclinth = new Doclinth({
  apiKey: process.env.DOCLINTH_API_KEY!,
  baseUrl: "https://doclinth.com", // or set DOCLINTH_BASE_URL
});

// Binary (default) — returns the PDF bytes.
const pdf = await doclinth.generate({
  templateId: "b1c2d3e4-…",
  data: { invoice_number: "INV-1042", total: 2592 },
});
await fs.writeFile("invoice.pdf", pdf);

// Signed URL — returns { url, expiresAt }.
const { url, expiresAt } = await doclinth.generate({
  templateId: "b1c2d3e4-…",
  data: { total: 2592 },
  output: "url",
});

// Per-request render options (format, landscape, margins, metadata, filename).
// watermark is paid plans only.
const labeled = await doclinth.generate({
  templateId: "b1c2d3e4-…",
  data: { total: 2592 },
  format: "Letter",
  landscape: false,
  margins: { top: "20mm", right: "16mm", bottom: "20mm", left: "16mm" },
  metadata: { title: "Invoice 1042", author: "Acme Billing" },
  filename: "invoice-1042.pdf",
  strict: true,
});

Templates

Discover template ids, learn a template's data contract, and author new templates from a prompt — the same surface an agent uses over MCP.

// List your templates.
const templates = await doclinth.listTemplates();

// Learn exactly what `data` a template expects before you render it.
const detail = await doclinth.getTemplate(templates[0].id);
detail.variables; // ["customer.name", "items", "total", …]
detail.sampleData; // a realistic example payload

// AI-author a new template from a description. It is saved as a DRAFT —
// generate keeps rendering the last published version until you publish it in
// the dashboard. Consumes your monthly AI-authoring allowance.
const created = await doclinth.createTemplate({
  prompt: "A packing slip with an order number, ship-to address, and a line-item table",
});
created.id; // pass this to getTemplate / generate once published

// Check the status of a past generation (by its X-Request-Id).
const status = await doclinth.getGeneration("req_…");
status.status; // "success" | "error"

Retries & idempotency

By default the client retries 429 and 5xx responses (and network errors) up to twice with exponential backoff, honoring Retry-After. To make those retries safe, generate attaches an Idempotency-Key automatically — so a retried request can never generate (or bill) a second PDF. Provide your own key to dedupe across process restarts:

await doclinth.generate({ templateId: "b1c2d3e4-…", data, idempotencyKey: orderId });

Set maxRetries: 0 to disable retries (and the automatic key). createTemplate is non-idempotent and AI-metered, so it only retries a pre-work 429, never a 5xx — a dropped response never risks a duplicate (billed) template.

Errors

Non-2xx responses throw a DoclinthError with a stable code and status:

import { Doclinth, DoclinthError } from "@doclinth/sdk";

try {
  await doclinth.generate({ templateId, data });
} catch (e) {
  if (e instanceof DoclinthError && e.code === "quota_exceeded") {
    // prompt an upgrade
  }
}

See the error reference for all codes.