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

@singleton-sd/post-kit-client

v0.4.0

Published

Trusted server-side TypeScript client for the PostKit API

Readme

@singleton-sd/post-kit-client

Thin typed SDK for trusted server-side Node.js / TypeScript consumers calling the PostKit API (POST /emails/send).

Server-side only

Do not ship this package (or long-lived POSTKIT_API_KEY values) to the browser. Public contact forms and other client UIs must POST to your own server endpoint; that intermediary then uses PostKitClient with POSTKIT_API_KEY from Azure Key Vault (ssd-global-kv-prod-ae) only — never from browser code or long-lived app settings.

Install

pnpm add @singleton-sd/post-kit-client

Usage

import { PostKitClient } from '@singleton-sd/post-kit-client';

const postKit = new PostKitClient({
  endpoint: process.env.POSTKIT_URL!,
  apiKey: process.env.POSTKIT_API_KEY!,
});

await postKit.send({
  template: 'marketing.contact-us',
  to: '[email protected]',
  variables: { name, email, message },
});

// Optional: pass your own trace id (8–128 alphanumeric / hyphen / underscore)
await postKit.send(request, { correlationId: 'my-trace-01' });

Options

| Option | Description | | --- | --- | | endpoint | Base URL of the PostKit API (trailing slash stripped) | | apiKey | Bearer token for Authorization | | timeout | Request timeout ms (default 30_000). Pass 0 to disable; with no per-call AbortSignal, the request then runs indefinitely | | correlationId | Default x-correlation-id for every send(); per-call SendOptions.correlationId overrides | | fetch | Injectable fetch (for tests); defaults to globalThis.fetch |

Auth lives on the constructor so the strategy can evolve without changing send().

send(request, options?)

| Option | Description | | --- | --- | | signal | Optional AbortSignal combined with the client timeout | | correlationId | Per-request trace id sent as x-correlation-id; overrides a client default |

On success, SendResponse.id is the correlation id the API used (yours if supplied and valid, or server-generated). Invalid values are rejected before the request with PostKitRequestError code INVALID_CORRELATION_ID.

Errors

Non-2xx responses and client-side failures throw PostKitRequestError:

  • status — HTTP status when available
  • code — API PostKitErrorCode, or 'TIMEOUT' / 'NETWORK_ERROR' / 'INVALID_CORRELATION_ID'
  • correlationId — from the error body when present
import { PostKitClient, PostKitRequestError } from '@singleton-sd/post-kit-client';

try {
  await postKit.send(request, { signal: AbortSignal.timeout(5_000) });
} catch (err) {
  if (err instanceof PostKitRequestError) {
    console.error(err.code, err.status, err.correlationId);
  }
  throw err;
}

Request/response bodies use types from @singleton-sd/post-kit-types (SendRequest, SendResponse, PostKitErrorResponse).

Development

pnpm test
pnpm build