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

@thormail/client

v1.0.0

Published

Official Node.js client for ThorMail Self-Hosted API - Secure queue-based delivery for email, SMS, push notifications

Readme

@thormail/client

Official Node.js client for the ThorMail Self-Hosted API. Queue-based delivery for email, SMS, push notifications, and webhooks.

For more information about ThorMail, visit thormail.io.

npm version License: MIT

[!CAUTION] SECURITY WARNING: SERVER-SIDE USE ONLY

This client is designed exclusively for Node.js (backend) environments. NEVER use this client in browser-based applications (React, Vue, etc.) as it will expose your Workspace ID and API Key to the public. exposure of these credentials can lead to unauthorized usage of your ThorMail instance.

Features

  • Server-Side Optimized - Exclusive for Node.js backends
  • 🔒 Secure - Designed to keep your credentials safe on the server
  • 📦 Zero Dependencies - Lightweight and fast
  • 🔄 Auto-retry - Exponential backoff with jitter for reliability

Installation

npm install @thormail/client
yarn add @thormail/client
pnpm add @thormail/client

Quick Start (Node.js)

import { ThorMailClient } from '@thormail/client';

// Initialize with your Self-Hosted instance headers
const client = new ThorMailClient({
  baseUrl: 'https://api.your-thormail-server.com', // Your implementation URL
  workspaceId: 'your-workspace-id',
  apiKey: 'your-api-key'
});

// Send a single email
try {
  const result = await client.send({
    to: '[email protected]',
    subject: 'Welcome!',
    body: '<h1>Hello {{name}}!</h1>',
    data: { name: 'John' }
  });
  console.log('Queued with ID:', result.id);
} catch (error) {
  console.error('Delivery failed:', error.message);
}

Usage

Initialization

import { ThorMailClient, createClient } from '@thormail/client';

// Using constructor
const client = new ThorMailClient({
  baseUrl: 'https://api.your-thormail-server.com',
  workspaceId: 'your-workspace-id',
  apiKey: 'your-api-key',
  timeout: 30000,
  retry: {
    maxRetries: 3,
    baseDelay: 1000
  }
});

Send Single Message

// With template
const result = await client.send({
  to: '[email protected]',
  templateId: 'welcome-email',
  data: {
    name: 'John Doe',
    verificationCode: 'ABC123'
  }
});

// With inline content
const result = await client.send({
  to: '[email protected]',
  subject: 'Order Confirmation',
  body: `
    <h1>Thanks for your order, {{name}}!</h1>
    <p>Order #{{orderId}} has been confirmed.</p>
  `,
  data: {
    name: 'John',
    orderId: 'ORD-12345'
  }
});

// Schedule for later
const result = await client.send({
  to: '[email protected]',
  templateId: 'reminder',
  scheduledAt: '2024-12-25T09:00:00Z'
});

Send SMS

const result = await client.send({
  to: '+1234567890',
  type: 'SMS',
  body: 'Your verification code is: 123456',
  data: {
    from_number: '+0987654321'
  }
});

Send Push Notification

const result = await client.send({
  to: 'device-token-here',
  type: 'PUSH',
  subject: 'New Message',
  body: 'You have a new message from John',
  data: {
    sound: 'default',
    badge: 1
  }
});

Send Batch Messages

const result = await client.sendBatch({
  templateId: 'newsletter',
  emails: [
    { to: '[email protected]', data: { name: 'Alice', promo: 'SAVE20' } },
    { to: '[email protected]', data: { name: 'Bob', promo: 'SAVE15' } },
    { to: '[email protected]', data: { name: 'Charlie' } }
  ]
});

console.log(`Queued ${result.count} messages`);
console.log('Queue IDs:', result.ids);

API Reference

ThorMailClient

Constructor Options

| Option | Type | Required | Default | Description | |--------|------|----------|---------|-------------| | baseUrl | string | Yes | - | URL of your ThorMail Self-Hosted API | | workspaceId | string | Yes | - | Your workspace identifier | | apiKey | string | Yes | - | Your private workspace API key | | timeout | number | No | 30000 | Request timeout in milliseconds | | retry.maxRetries | number | No | 3 | Maximum retry attempts |

Methods

  • send(payload: MessagePayload): Queue a single message.
  • sendBatch(payload: BatchPayload): Queue multiple messages efficiently.
  • configure(config): Update client configuration at runtime.
  • getConfig(): Get current configuration (sanitized).

ThorMailError

Custom error class with helper methods:

  • isRateLimited(): 429 Too Many Requests
  • isAuthError(): 401 Unauthorized
  • isSuppressed(): 403 Recipient Suppressed
  • isRetryable(): Network errors or 5xx server errors

Requirements

  • Node.js 18+
  • A running instance of ThorMail Self-Hosted

License

MIT © ThorMail