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/react

v0.1.0

Published

React bindings for Frontmail: FrontmailProvider, useSendEmail and <FrontmailForm> with Turnstile.

Readme

@frontmail/react

React bindings for Frontmail: provider, hooks with send status, and a <FrontmailForm> with built-in Cloudflare Turnstile.

npm i @frontmail/react
import { FrontmailProvider, FrontmailForm, useSendEmail } from '@frontmail/react';

const options = { publicKey: 'pk_…' }; // keep stable (module constant or useMemo)

export function App() {
  return (
    <FrontmailProvider options={options}>
      <FrontmailForm
        serviceId="svc_…"
        templateId="tpl_…"
        turnstileSiteKey="0x4AAA…" // optional
        onSuccess={(r) => console.log(r.messageId, r.status)}
        onError={(e) => console.error(e.code)}
      >
        {({ status, error }) => (
          <>
            <input name="email" type="email" required />
            <textarea name="message" required />
            <button disabled={status === 'sending'}>Send</button>
            {status === 'held' && <p>Accepted – will be delivered shortly.</p>}
            {error && <p role="alert">{error.message}</p>}
          </>
        )}
      </FrontmailForm>
    </FrontmailProvider>
  );
}

function Subscribe() {
  const { send, status, error, result, reset } = useSendEmail('svc_…', 'tpl_…');
  return <button onClick={() => send({ email: '[email protected]' })}>{status}</button>;
}

API

  • <FrontmailProvider options? client?> – creates a client (publicKey, apiUrl, retry, timeoutMs, blockHeadless, blockList, limitRate, …) or uses the one you pass.
  • useFrontmail() – the client (send, sendForm, getStatus).
  • useSendEmail(serviceId, templateId) → { send(params, options?), sendForm(form, options?), status, error, result, reset }. status: idle → sending → sent | held | error (sent = accepted and queued, held = accepted and waiting for credits). send resolves with the result or undefined on error – it never rejects.
  • <FrontmailForm serviceId? templateId turnstileSiteKey? turnstileOptions? sendOptions? resetOnSuccess? onSuccess? onError?> – renders a <form> (other props are passed through, data-status reflects the status). Children may be a render function receiving { status, error, result }. The Turnstile script is loaded lazily and the widget is reset after each submit.

The entry is marked 'use client' for React Server Components frameworks.

Errors

error is always a FrontmailError (NetworkError, ValidationError, AuthError, InsufficientCreditsError, RateLimitError, BlockedError) with code, status, message, docsUrl, details. Retries (network, 5xx, 429) with a stable idempotency key happen before an error is reported.

Typed params

FRONTMAIL_PRIVATE_KEY=sk_… npx frontmail types   # from @frontmail/node → frontmail-env.d.ts

The generated file augments FrontmailTemplates in @frontmail/react, so useSendEmail('svc', 'tpl_contact').send({...}) is type-checked.

MIT