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

nuxt-mailkite

v0.1.0

Published

MailKite for Nuxt — receive inbound email as a signed webhook route in your Nuxt app, and send over your verified domain.

Readme

What it does

The module registers a POST /api/mailkite/inbound endpoint in your Nuxt app. When mail arrives at any address on your verified domain, MailKite POSTs a signed email.received event there; the module verifies the x-mailkite-signature header (HMAC-SHA256, no network call) and hands the event to your handler module — server/mailkite.ts by default. It also gives every nitro route useMailKite() (the mailkite SDK client as a singleton) and the webhook reply helpers as auto-imports, so an auto-reply bot is a one-file affair.

Install

npx nuxt module add mailkite

Or manually:

npm install nuxt-mailkite
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-mailkite'],
})

Set your secrets in .env (standard Nuxt runtime-config env mapping):

NUXT_MAILKITE_API_KEY=mk_…               # for sending
NUXT_MAILKITE_WEBHOOK_SECRET=whsec_…     # for receiving

Receive email — an auto-reply bot in one file

Create server/mailkite.ts; its default export handles every verified inbound email (useMailKite() and the reply helpers are nitro auto-imports — no import needed):

// server/mailkite.ts
import type { MailKiteInboundHandler } from 'nuxt-mailkite'

const handler: MailKiteInboundHandler = async (event) => {
  const m = event.message
  if (event.type !== 'email.received' || !m) return replyOk()
  await useMailKite().send({
    from: '[email protected]',            // an address on your verified domain
    to: m.from,
    subject: `Re: ${m.subject ?? 'your email'}`,
    inReplyTo: m.messageId,
    text: 'Thanks — got your message. A human will follow up soon.',
  })
  return replyOk()
}

export default handler

Point your MailKite domain webhook at https://your-site.com/api/mailkite/inbound (dashboard → domain → Webhooks, or mk.setWebhook(...) from the mailkite SDK).

Your handler can return:

| Return value | Response sent to MailKite | | --- | --- | | undefined / void | replyOk() — acknowledge | | a string — use replyOk(), replySpam(), replyDrop(), replyBlockSender() | sent verbatim (control-mode replies act on the message) | | a plain object | JSON-serialized | | a Response | returned as-is | | a thrown error | 500 — MailKite retries the delivery |

No server/mailkite.ts yet? Deliveries are still verified, logged, and acknowledged — nothing is lost.

Send email

useMailKite() returns the mailkite SDK client, authenticated with NUXT_MAILKITE_API_KEY. Use it in any server route, nitro task, or the inbound handler:

// server/api/invoice.post.ts
export default defineEventHandler(async () => {
  const { id, status } = await useMailKite().send({
    from: '[email protected]',
    to: '[email protected]',
    subject: 'Your invoice #1042',
    html: '<p>Thanks! Receipt attached.</p>',
  })
  return { id, status }
})

The full SDK surface (domains, templates, routes, broadcasts…) is on the same client — see the mailkite docs.

Environment variables

| Variable | Runtime config | Used by | Required | Where to get it | | --- | --- | --- | --- | --- | | NUXT_MAILKITE_WEBHOOK_SECRET | mailkite.webhookSecret | inbound endpoint (signature verification) | for receiving | dashboard → Webhooks | | NUXT_MAILKITE_API_KEY | mailkite.apiKey | useMailKite() | for sending | dashboard → API keys |

You can also set them in nuxt.config.ts under runtimeConfig.mailkite — the env vars override at runtime (standard Nuxt behavior). They are server-only and never reach the client bundle.

Options

export default defineNuxtConfig({
  modules: ['nuxt-mailkite'],
  mailkite: {
    inboundPath: '/api/mailkite/inbound', // route for the registered endpoint
    handler: 'server/mailkite.ts',        // module whose default export handles inbound email
  },
})

| Option | Default | Notes | | --- | --- | --- | | inboundPath | /api/mailkite/inbound | Registered as a POST-only nitro route. | | handler | server/mailkite.ts | Also probes .js/.mts/.mjs. An explicitly set path that doesn't exist fails the build. |

Notes

  • Runtimes: works on the node, Vercel, and Cloudflare nitro presets. The SDK's verifyWebhook uses node:crypto — on Cloudflare, nitro's nodejs_compat covers it.
  • DevTools: the module shows up in Nuxt DevTools (Modules tab), and the inbound route is visible under Server Routes.

License

MIT © MailKite