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

@paperjsx/templates

v0.1.0

Published

Ready-to-use document templates with sample data

Readme

@paperjsx/templates

Document templates for invoices, reports, and contracts usually live in proprietary SaaS dashboards or as untyped JSON blobs with no validation. This package provides 13 domain-specific templates as Zod schemas with TypeScript types, validation functions, and realistic sample data — ready to feed into @paperjsx/json-to-pptx or @paperjsx/json-to-docx.

npm CI

Install

npm install @paperjsx/templates

Requires Node.js >= 18. Zero runtime dependencies beyond zod, qrcode, and bwip-js.

Quick Start

import {
  sampleInvoiceData,
  validateInvoiceData,
  InvoiceDataSchema,
  type InvoiceData,
} from "@paperjsx/templates";

// 1. Use sample data to test your pipeline
console.log(sampleInvoiceData);
// { company: { name: "...", ... }, customer: { ... }, items: [...], ... }

// 2. Validate your own data
const result = validateInvoiceData(myData);
// Throws ZodError if invalid

// 3. Get the TypeScript type
const invoice: InvoiceData = {
  company: { name: "Acme Corp", address: "123 Main St" },
  customer: { name: "TechCorp", address: "456 Oak Ave" },
  items: [
    { description: "Enterprise License", quantity: 1, unitPrice: 12000 },
    { description: "Support Package", quantity: 1, unitPrice: 2400 },
  ],
  subtotal: 14400,
  taxRate: 0.08875,
  tax: 1278,
  total: 15678,
  invoiceNumber: "INV-2026-001",
  date: "2026-03-15",
  dueDate: "2026-04-14",
};

Templates

| Template | Export Prefix | Category | Key Fields | | --- | --- | --- | --- | | SaaS Invoice | InvoiceData | Financial | company, customer, items, tax, total, currency | | Medical Lab Report | LabReportData | Healthcare | patient, physician, lab, tests (with normal/high/low/critical flags) | | Bill of Lading | BillOfLadingData | Logistics | shipper, consignee, cargo, freight details, hazmat | | Analytics Report | AnalyticsData | Reporting | metrics, charts, time range, data sections | | Legal Contract | LegalContractData | Legal | parties, clauses (numbered), signatures, effective date | | Event Ticket | EventTicketData | Entertainment | event, venue, seat, attendee, QR code, barcode | | Order Confirmation | OrderConfirmationData | E-commerce | order, items, shipping, tracking | | Startup Pitch Deck | PitchDeckData | Presentation | problem, solution, traction, market (TAM/SAM/SOM), team, ask | | Quarterly Review | QuarterlyReviewData | Presentation | KPIs, revenue, initiatives, goals, highlights | | Project Status | ProjectStatusData | Presentation | milestones, risks, timeline, budget, action items | | Meeting Minutes | MeetingMinutesData | Business | attendees, agenda, decisions, action items, next meeting | | Employee Handbook | EmployeeHandbookData | HR | policies, benefits, workplace guidelines, acknowledgment | | Technical Proposal | TechnicalProposalData | Business | scope, approach, timeline (phases), pricing, deliverables |

Per-Template Exports

Every template exports 4 items following the same naming pattern:

// Schema (Zod)
import { InvoiceDataSchema } from "@paperjsx/templates";

// Sample data (realistic fixture)
import { sampleInvoiceData } from "@paperjsx/templates";

// Validator function (throws on invalid input)
import { validateInvoiceData } from "@paperjsx/templates";

// TypeScript type
import { type InvoiceData } from "@paperjsx/templates";

Replace Invoice with any template name: LabReport, BillOfLading, Analytics, LegalContract, EventTicket, OrderConfirmation, PitchDeck, QuarterlyReview, ProjectStatus, MeetingMinutes, EmployeeHandbook, TechnicalProposal.

Utilities

QR Code Generation

import {
  generateQRCodeDataURL,  // async: string -> PNG data URL
  generateQRCodeSVG,      // async: string -> SVG data URL
  generateQRCodeSync,     // sync (pre-cached)
} from "@paperjsx/templates";

const qr = await generateQRCodeDataURL("https://example.com/ticket/ABC123");
// "data:image/png;base64,iVBORw0KGgo..."

Barcode Generation

import {
  generateBarcode128,  // CODE128 (general purpose)
  generateBarcode39,   // CODE39 (industrial)
  generateBarcodeITF,  // Interleaved 2 of 5 (logistics)
} from "@paperjsx/templates";

const barcode = await generateBarcode128("INV-2026-001");
// SVG data URL

i18n Formatting

import {
  formatCurrency,
  formatDate,
  formatNumber,
  formatPercent,
  formatDateRange,
  createFormatter,
} from "@paperjsx/templates";

formatCurrency(1234.56, "EUR", "de-DE");     // "1.234,56 €"
formatCurrency(1234.56, "JPY", "ja-JP");     // "¥1,235"
formatDate("2026-03-15", "en-US");           // "March 15, 2026"
formatPercent(0.342, "en-US");               // "34.2%"
formatDateRange("2026-01-01", "2026-03-31", "en-US"); // "Jan 1 – Mar 31, 2026"

// Reusable formatter for a specific locale
const fmt = createFormatter("de-DE", "EUR");
fmt.currency(99.99);  // "99,99 €"
fmt.date("2026-03-15"); // "15. März 2026"
fmt.number(1234567);    // "1.234.567"

Supported locales: en-US, en-GB, de-DE, fr-FR, ja-JP, zh-CN, pt-BR, es-ES, it-IT

Supported currencies: USD, EUR, GBP, JPY, CNY, INR, BRL, CAD, AUD, CHF (plus any valid ISO 4217 code)

Template Registry

Browse and filter templates at runtime:

import { templateRegistry } from "@paperjsx/templates";

// List all templates
templateRegistry.forEach((t) => {
  console.log(`${t.id}: ${t.name} (${t.category})`);
  console.log(`  Tags: ${t.tags.join(", ")}`);
  console.log(`  Features: ${t.features.join(", ")}`);
});

// Filter by category
const financialTemplates = templateRegistry.filter(
  (t) => t.category === "Financial"
);

Each registry entry includes: id, name, category, difficulty (beginner/intermediate/advanced), description, tags[], features[].

Examples

Validate and Render an Invoice

import { validateInvoiceData, sampleInvoiceData } from "@paperjsx/templates";
import { renderToDocx } from "@paperjsx/json-to-docx";

// Validate input data
const data = validateInvoiceData(myInvoiceData);

// Pass to rendering engine
const result = await renderToDocx({
  type: "DocxDocument",
  template: "invoice",
  data,
});

Generate a Pitch Deck with Sample Data

import { samplePitchDeckData } from "@paperjsx/templates";
import { compileAgentDocument, PaperEngine } from "@paperjsx/json-to-pptx";

// samplePitchDeckData includes realistic startup data:
// company name, problem, solution, TAM/SAM/SOM, traction metrics, team bios, funding ask
console.log(samplePitchDeckData.company); // "NeuralFlow"
console.log(samplePitchDeckData.market.tam); // "$48B"

QR Code for Event Tickets

import {
  sampleEventTicketData,
  generateQRCodeDataURL,
  generateBarcode128,
} from "@paperjsx/templates";

const qr = await generateQRCodeDataURL(
  `https://tickets.example.com/${sampleEventTicketData.ticketId}`
);

const barcode = await generateBarcode128(sampleEventTicketData.ticketId);

// Use in document generation as image src

Multi-Locale Currency Formatting

import { createFormatter, LOCALES, CURRENCIES } from "@paperjsx/templates";

const locales = ["en-US", "de-DE", "ja-JP", "pt-BR"];

for (const locale of locales) {
  const fmt = createFormatter(locale, "USD");
  console.log(`${locale}: ${fmt.currency(2499.99)}`);
}
// en-US: $2,499.99
// de-DE: 2.499,99 $
// ja-JP: $2,499.99
// pt-BR: US$ 2.499,99

Limitations

  • Templates provide schemas and sample data only — they do not render documents themselves. Pair with @paperjsx/json-to-pptx or @paperjsx/json-to-docx for rendering.
  • QR code and barcode generation is async (except generateQRCodeSync for pre-cached values).
  • i18n formatting uses the Intl API. Locale support depends on the Node.js ICU data available in your runtime.

Documentation

paperjsx.com/docs/templates

License

MIT