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

@crossplatformai/email

v0.9.0

Published

Shared email module for CrossPlatform.ai projects.

Readme

@crossplatformai/email

Shared email module providing a unified interface for sending emails across CrossPlatform.ai projects.

Features

  • Framework-agnostic: Works with Hono, Next.js, Express, or any framework
  • Email providers: Postmark, Mock (for development)
  • Type-safe: Full TypeScript support
  • Lightweight runtime: Only React Email dependencies for templates
  • React Email: Beautiful, responsive email templates built with React Email

Installation

npm install @crossplatformai/email

Usage

Basic Setup

import { createEmailProvider } from '@crossplatformai/email';
import type { EmailConfig } from '@crossplatformai/email';
import { reactEmailRenderer } from '@crossplatformai/email/react';

const emailProvider = createEmailProvider(
  {
    provider: 'postmark',
    apiKey: process.env.POSTMARK_API_KEY,
    from: '[email protected]',
    appName: 'My App',
    isDevelopment: process.env.NODE_ENV === 'development',
  },
  reactEmailRenderer,
);

// Send emails
await emailProvider.sendVerificationCode('[email protected]', '123456');
await emailProvider.sendWelcome('[email protected]');

With React Email Renderer

import { createEmailProvider } from '@crossplatformai/email';
import { reactEmailRenderer } from '@crossplatformai/email/react';

const emailProvider = createEmailProvider(
  {
    provider: 'postmark',
    apiKey: process.env.POSTMARK_API_KEY,
    from: '[email protected]',
    appName: 'My App',
    isDevelopment: process.env.NODE_ENV === 'development',
  },
  reactEmailRenderer,
);

With Hono (API Framework)

import { Hono } from 'hono';
import { createEmailProvider } from '@crossplatformai/email';
import { reactEmailRenderer } from '@crossplatformai/email/react';

const app = new Hono();
const emailProvider = createEmailProvider(
  {
    provider: 'postmark',
    apiKey: process.env.POSTMARK_API_KEY,
    from: '[email protected]',
    appName: 'My App',
  },
  reactEmailRenderer,
);

app.post('/send-verification', async (c) => {
  const { email, code } = await c.req.json();

  try {
    await emailProvider.sendVerificationCode(email, code);
    return c.json({ success: true });
  } catch (error) {
    return c.json({ error: 'Failed to send email' }, 500);
  }
});

With Next.js (Route Handler)

import { NextResponse } from 'next/server';
import { createEmailProvider } from '@crossplatformai/email';
import { reactEmailRenderer } from '@crossplatformai/email/react';

const emailProvider = createEmailProvider(
  {
    provider: 'postmark',
    apiKey: process.env.POSTMARK_API_KEY,
    from: '[email protected]',
    appName: 'My App',
  },
  reactEmailRenderer,
);

export async function POST(request: Request) {
  const { email, code } = await request.json();

  try {
    await emailProvider.sendVerificationCode(email, code);
    return NextResponse.json({ success: true });
  } catch (error) {
    return NextResponse.json(
      { error: 'Failed to send email' },
      { status: 500 },
    );
  }
}

Configuration

Environment Variables

# Email provider configuration
EMAIL_PROVIDER=postmark        # Email provider (postmark or mock)
POSTMARK_API_KEY=your-api-key  # Postmark API key
[email protected]  # From email address
WEB_URL=https://yourdomain.com # Base URL for email links
POSTMARK_API_URL=https://api.postmarkapp.com # Optional: custom Postmark API URL

EmailConfig Interface

interface EmailConfig {
  provider?: 'postmark' | 'mock'; // Email provider
  apiKey?: string; // API key for provider
  from?: string; // From email address
  isDevelopment?: boolean; // Development mode flag
  isTest?: boolean; // Test mode flag
  appName: string; // App name for email branding
  colors?: EmailColorTokens; // Custom color tokens
  renderer?: EmailRenderer; // Email renderer for templates
}

Providers

PostmarkEmailProvider

Production-ready email provider using Postmark API:

  • Sends real emails via Postmark
  • Requires API key
  • Full HTML and text email support

MockEmailProvider

Development/testing provider that logs emails to console:

  • No actual emails sent
  • Logs email content to console
  • Perfect for development and testing

Development Mode (Mock Provider)

const emailProvider = createEmailProvider({
  provider: 'mock', // No actual emails sent
  isDevelopment: true,
});

// Logs to console instead of sending emails
await emailProvider.sendVerificationCode('[email protected]', '123456');
// Console: [MOCK EMAIL] Verification code for [email protected]: 123456 (expires in 60 minutes)

API Reference

createEmailProvider(config, renderer?)

Factory function to create an email provider instance.

Parameters:

  • config: EmailConfig - Configuration object
  • renderer?: EmailRenderer - Optional email renderer (required for Postmark)

Returns: EmailProvider

Subpath Exports

  • @crossplatformai/email - Main exports (createEmailProvider, types, providers, colors)
  • @crossplatformai/email/providers - Provider implementations (PostmarkEmailProvider, MockEmailProvider)
  • @crossplatformai/email/react - React Email renderer and templates
  • @crossplatformai/email/types - TypeScript type definitions

Testing

# Run tests
pnpm test

# Run tests with coverage
pnpm test --coverage

License

SEE LICENSE IN LICENSE