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

keplars

v2.1.0

Published

Official JavaScript/TypeScript SDK for Keplars Email API - modern transactional email service

Readme

Keplars Email SDK for JavaScript/TypeScript

Official JavaScript/TypeScript SDK for the Keplars Email API - modern transactional email service with priority-based delivery.

Installation

npm install keplars
# or
yarn add keplars
# or
bun add keplars

Quick Start

import { Keplars } from 'keplars';

const client = new Keplars({
  apiKey: 'kms_<workspaceId>.live_<secret>'
});

const response = await client.emails.sendInstant({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Your verification code is 123456',
  html: '<p>Your verification code is <strong>123456</strong></p>'
});

console.log('Job ID:', response.data.job_id);

Configuration

const client = new Keplars({
  apiKey: 'your-api-key',
  baseUrl: 'https://custom.api',
  timeout: 30000,
  maxRetries: 3,
  retryDelay: 1000
});

Environment Variables

  • KEPLARS_API_KEY - Your API key
  • KEPLARS_BASE_URL - Custom API base URL

API Key Types

| Type | Format | Used for | |---|---|---| | Regular | kms_<id>.live_<secret> | Email sending | | Admin | kms_<id>.adm_<secret> | Contacts, audiences, automations, domains |

Email Sending

Priority Levels

| Method | Delivery | Use case | |---|---|---| | sendInstant | 0–5 sec | OTPs, login codes, critical alerts | | sendHigh | 0–30 sec | Transactional, notifications | | sendAsync / send | 0–5 min | General transactional | | sendBulk | Idle | Newsletters, marketing |

const response = await client.emails.sendInstant({
  from: '[email protected]',
  to: [{ email: '[email protected]', name: 'John Doe' }],
  subject: 'Welcome!',
  html: '<h1>Welcome aboard</h1>'
});

console.log(response.data.job_id);
console.log(response.data.priority);

Request Fields

| Field | Type | Required | Description | |---|---|---|---| | to | string \| EmailRecipient[] | Yes | Recipient(s) | | from | string | Yes | Sender email | | subject | string | Yes | Email subject | | html | string | One of | HTML body | | text | string | One of | Plain text body | | template_id | string | One of | Template ID | | template_data | object | No | Template variables | | cc | EmailRecipient[] | No | CC recipients | | bcc | EmailRecipient[] | No | BCC recipients | | reply_to | string | No | Reply-to address | | custom_headers | object | No | Custom email headers |

Response Shape

{
  success: true,
  message: 'Email queued',
  data: {
    job_id: 'job_abc123',
    priority: 'instant'
  }
}

Send with Template

const response = await client.emails.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Password Reset',
  template_id: 'tpl_reset_password',
  template_data: {
    name: 'John',
    reset_link: 'https://example.com/reset/token123'
  }
});

Schedule Email

const response = await client.emails.schedule({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Your weekly digest',
  html: '<p>Here is your weekly digest...</p>',
  scheduled_for: '2026-06-01T09:00:00Z',
  priority: 'bulk'
});

Contacts (Admin API Key Required)

const adminClient = new Keplars({
  apiKey: 'kms_<workspaceId>.adm_<secret>'
});

await adminClient.contacts.add({
  email: '[email protected]',
  name: 'John Doe',
  audience_id: 'aud_abc123'
});

const contact = await adminClient.contacts.get('[email protected]');

const contacts = await adminClient.contacts.list('aud_abc123', 1, 20);

await adminClient.contacts.update('[email protected]', { name: 'Jane Doe' });

await adminClient.contacts.delete('[email protected]');

Audiences (Admin API Key Required)

const audience = await adminClient.audiences.create('Newsletter Subscribers', 'Main newsletter list');

const audiences = await adminClient.audiences.list(1, 20);

const audience = await adminClient.audiences.get('aud_abc123');

await adminClient.audiences.delete('aud_abc123');

Automations (Admin API Key Required)

const automations = await adminClient.automations.list();

const automation = await adminClient.automations.get('auto_abc123');

await adminClient.automations.enroll('auto_abc123', '[email protected]');

await adminClient.automations.unenroll('auto_abc123', '[email protected]');

Domains (Admin API Key Required)

const domain = await adminClient.domains.add('mail.yourcompany.com');

const domains = await adminClient.domains.list();

const status = await adminClient.domains.getStatus('dom_abc123');

const result = await adminClient.domains.verify('dom_abc123');

const apiKey = await adminClient.domains.createApiKey({ domain_id: 'dom_abc123', name: 'Production Key' });

await adminClient.domains.delete('dom_abc123');

Error Handling

import { Keplars, AuthenticationError, RateLimitError } from 'keplars';

try {
  const response = await client.emails.sendInstant({ ... });
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof RateLimitError) {
    console.error('Rate limited, retry after:', error.retryAfter);
  }
}

TypeScript Types

import type {
  EmailRecipient,
  SendEmailRequest,
  SendEmailResponse,
  Contact,
  Audience,
  Automation,
} from 'keplars';