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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@artamail/nuxt

v0.1.1

Published

ArtaMail SDK module for Nuxt 3 applications

Readme

@artamail/nuxt

ArtaMail SDK module for Nuxt 3 applications. Send transactional and marketing emails with ease.

Installation

pnpm add @artamail/nuxt
# or
npm install @artamail/nuxt

Setup

Add the module to your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@artamail/nuxt'],

  artamail: {
    apiKey: process.env.ARTAMAIL_API_KEY
  }
});

Or use environment variables:

NUXT_ARTAMAIL_API_KEY=am_live_sk_xxx

Usage

In Server API Routes

// server/api/send-email.post.ts
export default defineEventHandler(async (event) => {
  const body = await readBody(event);

  const result = await sendEmail({
    to: body.email,
    template: 'welcome',
    data: { name: body.name }
  });

  return result;
});

Using the Client Directly

// server/api/templates.get.ts
export default defineEventHandler(async () => {
  const artamail = useArtaMail();
  return artamail.listTemplates();
});

Sending Batch Emails

// server/api/notify.post.ts
export default defineEventHandler(async (event) => {
  const { users, message } = await readBody(event);

  const result = await sendBatchEmails({
    emails: users.map(user => ({
      to: user.email,
      template: 'notification',
      data: { name: user.name, message }
    }))
  });

  return result;
});

Configuration

Module Options

export default defineNuxtConfig({
  modules: ['@artamail/nuxt'],

  artamail: {
    // API key (required)
    apiKey: 'am_live_sk_xxx',

    // Base URL (optional)
    baseUrl: 'https://mail.artamail.com',

    // Request timeout in ms (default: 30000)
    timeout: 30000,

    // Retry attempts (default: 3)
    retries: 3
  }
});

Environment Variables

All options can be set via environment variables:

NUXT_ARTAMAIL_API_KEY=am_live_sk_xxx
NUXT_ARTAMAIL_BASE_URL=https://mail.artamail.com
NUXT_ARTAMAIL_TIMEOUT=30000
NUXT_ARTAMAIL_RETRIES=3

Server Composables

useArtaMail()

Get the ArtaMail client instance:

const artamail = useArtaMail();

// Send email
await artamail.send({ to: '...', template: '...', data: {} });

// Get templates
const templates = await artamail.listTemplates();

// Manage contacts
await artamail.upsertContact({ email: '...', name: '...' });

sendEmail(options)

Send a single email:

const result = await sendEmail({
  to: '[email protected]',
  template: 'welcome',
  data: { name: 'John' },
  priority: 'high'
});

sendBatchEmails(options)

Send multiple emails:

const result = await sendBatchEmails({
  emails: [
    { to: '[email protected]', template: 'notification', data: { ... } },
    { to: '[email protected]', template: 'notification', data: { ... } },
  ]
});

Error Handling

import {
  ValidationError,
  AuthenticationError,
  RateLimitError
} from '@artamail/sdk';

export default defineEventHandler(async (event) => {
  try {
    return await sendEmail({ ... });
  } catch (error) {
    if (error instanceof ValidationError) {
      throw createError({ statusCode: 400, message: error.message });
    }
    if (error instanceof AuthenticationError) {
      throw createError({ statusCode: 401, message: 'Invalid API key' });
    }
    if (error instanceof RateLimitError) {
      throw createError({ statusCode: 429, message: 'Rate limited' });
    }
    throw error;
  }
});

TypeScript

Full TypeScript support:

import type {
  SendEmailOptions,
  SendEmailResult,
  Template,
  Contact
} from '@artamail/sdk';

License

MIT