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

@frontmail/sdk-core

v0.1.0

Published

Isomorphic zero-dependency core of the Frontmail SDKs: HTTP client with retries, idempotency keys, typed errors, Turnstile and client-side guards.

Readme

@frontmail/sdk-core

Zero-dependency, isomorphic core used by every Frontmail SDK (@frontmail/browser, react, vue, svelte, node, emailjs-compat). You normally install one of those instead – use the core directly only when building your own integration.

npm i @frontmail/sdk-core
import { createClient } from '@frontmail/sdk-core';

const client = createClient({ publicKey: 'pk_…' });
const { messageId, status, statusToken } = await client.send('svc_…', 'tpl_…', { name: 'Jan' });
await client.sendForm('svc_…', 'tpl_…', '#contact-form'); // multipart, file inputs → attachments
await client.getStatus(messageId, { token: statusToken });

Client options

| Option | Default | Description | |---|---|---| | publicKey | – | pk_… for browsers (sent as user_id + X-Frontmail-Public-Key) | | privateKey | – | sk_…, server only (Authorization: Bearer) | | apiUrl | https://api.frontmail.dev | API origin | | retry | { retries: 3, baseDelayMs: 300, maxDelayMs: 10000 } | false disables retries | | timeoutMs | 15000 | per attempt (AbortController) | | blockHeadless | false | refuse to send from navigator.webdriver / headless user agents | | blockList | – | { list: string[], watchVariable: 'email' } – refuse listed values | | limitRate | – | { id?: string, throttle: ms } – one accepted send per throttle ms (localStorage) | | storageProvider | localStorage | { get(key), set(key, value) } (sync or async) for limitRate | | fetch | globalThis.fetch | custom fetch | | clientName | – | X-Frontmail-Client header value |

Per-call SendOptions accept the same guards plus idempotencyKey, turnstileToken, attachments ({ filename, contentType, contentBase64 } or { uploadId }) and signal.

Reliability

  • Retries with exponential backoff and full jitter for network errors, timeouts, 5xx and 429. 429 honours Retry-After (up to 60 s; longer waits fail immediately with RateLimitError).
  • Idempotency: every logical send gets an Idempotency-Key (UUID via crypto.randomUUID, with a getRandomValues fallback) that is reused across its retries, so a retry never sends twice.
  • The result is { messageId, status: 'queued' | 'held', statusToken, status_code: 202, text: 'OK' }. held means the email was accepted and waits for credits – it is never dropped.

Errors

Everything throws a FrontmailError (code, status, message, docsUrl, details, retryAfter):

| Class | When | |---|---| | NetworkError | no HTTP response (network_error, timeout), status: 0 | | ValidationError | 400 / 422 (e.g. invalid_template_params, see details) | | AuthError | 401, and 403 forbidden / origin_not_allowed / private_key_required | | InsufficientCreditsError | 402 (organization in reject mode) | | RateLimitError | 429 | | BlockedError | client-side block: headless_blocked, recipient_blocked (block list), rate_limited (limitRate) | | FrontmailError | anything else (404, 409, 413, 451, 5xx, aborted, invalid_response…) |

Error codes are documented at https://docs.frontmail.dev/reference/errors/.

Helpers

  • formToParams(form | selector) → { params, files, turnstileToken }
  • loadTurnstile(), renderTurnstile(el, { sitekey }), getTurnstileToken(siteKey | formOrContainer) – lazily loads https://challenges.cloudflare.com/turnstile/v0/api.js. Inside a form the widget adds a hidden cf-turnstile-response input that sendForm submits automatically; for send() pass { turnstileToken }.
  • blockHeadless, blockList, limitRate, isHeadlessBrowser, uuid, backoffDelay, parseRetryAfter.

Typed params

FrontmailTemplates is an empty interface that npx frontmail types (from @frontmail/node) augments, so send('tpl_contact', params) checks params at compile time. See @frontmail/node.

MIT