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

sendridge

v0.1.0

Published

Official Node.js SDK for the Sendridge email API

Readme

sendridge

Official Node.js SDK for Sendridge — transactional email for developers.

  • Typed end to end — full TypeScript definitions for every request and response.
  • Zero dependencies — uses the fetch built into Node 18+.
  • Dual module support — works with both import (ESM) and require (CommonJS).
  • Typed errors — every failure maps to a specific error class you can catch.
  • Safe retries — idempotent reads retry automatically with backoff; sends are never retried, so an email can never be delivered twice by the SDK.

Installation

npm install sendridge

Requires Node.js 18 or newer.

Setup

Grab an API key from your Sendridge dashboard (API Keys → Create key), then set it in your environment:

SENDRIDGE_API_KEY=sr_xxxxxxxxxxxxxxxx

Server-side only. Your API key grants full sending access to your account. Never use this SDK in browser code or expose the key to clients.

Quickstart

import { Sendridge } from "sendridge";

const sendridge = new Sendridge(); // reads SENDRIDGE_API_KEY

const { id } = await sendridge.emails.send({
  from: "[email protected]", // domain must be verified in your dashboard
  to: "[email protected]",
  subject: "Welcome aboard!",
  html: "<h1>Hello 👋</h1><p>Thanks for signing up.</p>",
});

console.log(`Queued email ${id}`);

CommonJS works too:

const { Sendridge } = require("sendridge");

Usage

Send an email

const result = await sendridge.emails.send({
  from: "[email protected]",
  to: ["[email protected]", "[email protected]"], // up to 50 recipients
  subject: "Your invoice",
  html: "<p>Invoice attached below.</p>",
  text: "Invoice attached below.",       // plain-text alternative
  replyTo: "[email protected]",
  tags: { type: "invoice" },
  metadata: { invoiceId: "INV-2026-0042" },
});
// result: { id, status: "queued", to, from, subject, createdAt }

Sending is asynchronous — the API queues the message and returns immediately with status: "queued".

Track an email

const email = await sendridge.emails.get(result.id);
// email.status: "queued" | "sending" | "sent" | "delivered" | "bounced" | "failed" | "complained"
// email.openCount, email.clickCount, email.errorMessage, ...

List your emails

const { data, pagination } = await sendridge.emails.list({ page: 1, limit: 20 });

Error handling

Every failure throws a subclass of SendridgeError:

import {
  Sendridge,
  SendridgeError,
  ValidationError,     // 400 — bad payload; check err.details for field errors
  AuthenticationError, // 401 — missing/invalid/revoked/expired API key
  PermissionError,     // 403 — e.g. sending domain not verified, plan restriction
  NotFoundError,       // 404 — unknown email id
  RateLimitError,      // 429 — plan or per-key rate limit hit
  ServerError,         // 5xx — Sendridge-side problem
  TimeoutError,        // request exceeded the timeout
  NetworkError,        // DNS/connection failure
} from "sendridge";

try {
  await sendridge.emails.send({ /* ... */ });
} catch (err) {
  if (err instanceof RateLimitError) {
    // back off and try again later
  } else if (err instanceof ValidationError) {
    console.error(err.message, err.details);
  } else if (err instanceof SendridgeError) {
    console.error(`Sendridge error ${err.statusCode}: ${err.message}`);
  } else {
    throw err;
  }
}

Configuration

const sendridge = new Sendridge("sr_...", {
  baseUrl: "https://api.sendridge.com", // override for self-hosted / local dev
  timeoutMs: 30_000,                    // per-request timeout (default 30s)
  maxRetries: 2,                        // GET-only automatic retries (default 2)
});

Documentation

Full API reference and guides: https://sendridge.com/docs

License

MIT