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

@kiwiton-tech/email-sdk

v0.1.1

Published

Tiny client SDK for any website to submit contact forms and trigger transactional emails through the KiwiTon Tech Email Service.

Readme

@kiwiton-tech/email-sdk

Tiny client SDK for any website to submit contact forms (and other transactional emails) through the KiwiTon Tech Email Service.

  • Zero runtime dependencies.
  • Works in Node 18+, Next.js, Cloudflare Workers, Bun, modern browsers (server-side use recommended).
  • First-class Next.js App Router Route Handler.
  • First-class React hook for client-side forms.

Install

npm install @kiwiton-tech/email-sdk
# or
pnpm add @kiwiton-tech/email-sdk

Get your credentials

Each KiwiTon Tech client site is issued:

  • a siteKey — short slug like acme-corp, identifies the site to the email service
  • an apiKey — secret, scoped to that siteKey. Server-only. Never put this in a browser bundle.

Recipients (the actual contact-form destination emails) are configured server-side per siteKey. The client never specifies recipients, which prevents open-relay abuse.

Quick start — Next.js (App Router)

app/api/contact/route.ts:

import { createContactRoute } from '@kiwiton-tech/email-sdk/next';

export const POST = createContactRoute({
  siteKey: process.env.KIWITON_SITE_KEY!,
  apiKey:  process.env.KIWITON_API_KEY!,
});

app/contact/page.tsx:

'use client';
import { useKiwiTonContactForm } from '@kiwiton-tech/email-sdk/react';

export default function ContactPage() {
  const { submit, loading, error, result } = useKiwiTonContactForm();

  if (result?.success) return <p>Thanks — we'll be in touch.</p>;

  return (
    <form
      onSubmit={async (e) => {
        e.preventDefault();
        const fd = new FormData(e.currentTarget);
        await submit({
          name:    String(fd.get('name')),
          email:   String(fd.get('email')),
          subject: String(fd.get('subject')),
          message: String(fd.get('message')),
        });
      }}
    >
      <input name="name" required />
      <input name="email" type="email" required />
      <input name="subject" required />
      <textarea name="message" required />
      <button disabled={loading}>{loading ? 'Sending…' : 'Send'}</button>
      {error && <p role="alert">{error}</p>}
    </form>
  );
}

Quick start — direct server-side

import { KiwiTonEmail } from '@kiwiton-tech/email-sdk';

const ke = new KiwiTonEmail({
  siteKey: process.env.KIWITON_SITE_KEY!,
  apiKey:  process.env.KIWITON_API_KEY!,
});

const result = await ke.contact.send({
  name: 'Jane Doe',
  email: '[email protected]',
  subject: 'Hello',
  message: 'I would like to learn more.',
});
// { success: true, message: '...', emailId: '...' }

API

new KiwiTonEmail(options)

| Option | Type | Required | Default | |--------------|----------|----------|----------------------------------| | siteKey | string | yes | — | | apiKey | string | yes | — | | baseUrl | string | no | https://api.kiwiton-tech.com | | timeoutMs | number | no | 10000 | | fetch | fetch | no | globalThis.fetch | | headers | object | no | {} |

client.contact.send(input)

{
  name:    string;     // required, 1–200 chars
  email:   string;     // required, valid email
  subject: string;     // required, 1–500 chars
  message: string;     // required, 1–10,000 chars
  hp?:     string;     // honeypot — leave empty
  siteKey?: string;    // override (rare)
  meta?:   Record<string, string | number | boolean | null>;
}

Returns { success, message, emailId? }. Throws KiwiTonClientError on failure (network, validation, rate limit, etc).

client.health()

Probes the gateway. Returns { status }.

createContactRoute(options) (from /next)

Returns a Next.js App Router POST handler. Same options as KiwiTonEmail, plus:

  • onSuccess?(input) — async hook called after a successful submission
  • shouldAccept?(req) — return false to short-circuit with a 429 (e.g. your own rate limiter)

useKiwiTonContactForm(options?) (from /react)

Returns { submit, loading, error, result, reset }. Submits to your own server endpoint (default /api/contact), so the API key never leaves the server.

Errors

import { KiwiTonClientError } from '@kiwiton-tech/email-sdk';

try {
  await ke.contact.send(input);
} catch (e) {
  if (e instanceof KiwiTonClientError) {
    console.error(e.code, e.status, e.message, e.requestId);
  }
}

Codes: BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, CONFLICT, RATE_LIMITED, UPSTREAM_ERROR, INTERNAL_ERROR, NETWORK_ERROR.

License

MIT © KiwiTon Tech