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

ekilirelay

v1.0.4

Published

Ekilirelay is a fast, reliable, and free email API service that allows you to send emails with ease. Whether you need to send transactional emails, notifications, or bulk messages, Ekilirelay has you covered with its simple yet powerful API.

Readme

ekiliRelay package

The ekiliRelay package is a lightweight JavaScript/TypeScript library designed to simplify email sending and file uploading via the EkiliRelay API. Authenticate your requests with your API key and integrate our services seamlessly into your application.

Installation

Install the package using npm:

npm install ekilirelay

Then, import the package into your project:

import EkiliRelay from 'ekilirelay';

Usage

Vanilla JavaScript

You can use the package in any project that supports ES modules or a bundler. Below are two examples: one for sending emails and one for file uploads.

Sending an Email (Vanilla JS)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ekiliRelay Email Test</title>
</head>
<body>
  <button id="sendEmailBtn">Send Email</button>
  <script type="module">
    import EkiliRelay from 'ekilirelay';

    // Initialize the package with your API key
    const relay = new EkiliRelay("Your-EkiliRelay-Api-Key");

    document.getElementById("sendEmailBtn").addEventListener("click", () => {
      relay.sendEmail(
        '[email protected]',
        'Test Subject',
        'This is a test message.',
        'From: senderName <[email protected]>'
      )
      .then(response => {
        if (response.status === 'success') {
          console.log('Email sent successfully.');
        } else {
          console.error('Failed to send email:', response.message);
        }
      })
      .catch(error => {
        console.error('Error:', error);
      });
    });
  </script>
</body>
</html>

Uploading a File (Vanilla JS)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ekiliRelay File Upload</title>
</head>
<body>
  <input type="file" id="fileInput" />
  <script type="module">
    import EkiliRelay from 'ekilirelay';

    // Initialize the package with your API key
    const relay = new EkiliRelay("Your-EkiliRelay-Api-Key");

    document.getElementById('fileInput').addEventListener('change', async () => {
      const fileInput = document.getElementById('fileInput');
      if (fileInput.files && fileInput.files.length > 0) {
        const file = fileInput.files[0];
        try {
          const result = await relay.uploadFile(file);
          if (result.status === "success") {
            console.log("File uploaded successfully:", result);
            // You can use result.filename and result.url here
          } else {
            console.error("File upload failed:", result.message);
          }
        } catch (error) {
          console.error("Unexpected error:", error);
        }
      }
    });
  </script>
</body>
</html>

ReactJS

In a React application, you can use the package within your components. Below is an example using a functional component with hooks.

Example Component for Sending an Email

// EmailSender.jsx
import React, { useState } from 'react';
import EkiliRelay from 'ekilirelay';

const EmailSender = () => {
  const [status, setStatus] = useState('');
  const [apiKey, setApiKey] = useState('');
  const relay = new EkiliRelay(apiKey);

  const handleSendEmail = async () => {
    if (!apiKey) {
      setStatus("Please enter your API key.");
      return;
    }
    try {
      const response = await relay.sendEmail(
        '[email protected]',
        'Test Subject',
        'This is a test message.',
        'From: senderName <[email protected]>'
      );
      setStatus(response.status === 'success' ? "Email sent successfully." : `Failed: ${response.message}`);
    } catch (error) {
      setStatus(`Error: ${error.message}`);
    }
  };

  return (
    <div>
      <input
        type="text"
        placeholder="Enter your API key"
        value={apiKey}
        onChange={e => setApiKey(e.target.value)}
      />
      <button onClick={handleSendEmail}>Send Email</button>
      <p>{status}</p>
    </div>
  );
};

export default EmailSender;

Example Component for Uploading a File

// FileUploader.jsx
import React, { useState } from 'react';
import EkiliRelay from 'ekilirelay';

const FileUploader = () => {
  const [apiKey, setApiKey] = useState('');
  const [uploadStatus, setUploadStatus] = useState('');
  const relay = new EkiliRelay(apiKey);

  const handleFileChange = async (e) => {
    const file = e.target.files[0];
    if (!apiKey) {
      setUploadStatus("Please enter your API key.");
      return;
    }
    if (!file) {
      setUploadStatus("No file selected.");
      return;
    }
    setUploadStatus("Uploading...");
    try {
      const result = await relay.uploadFile(file);
      setUploadStatus(result.status === 'success' ? `Uploaded: ${result.filename}, URL: ${result.url}` : `Upload failed: ${result.message}`);
    } catch (error) {
      setUploadStatus(`Error: ${error.message}`);
    }
  };

  return (
    <div>
      <input
        type="text"
        placeholder="Enter your API key"
        value={apiKey}
        onChange={e => setApiKey(e.target.value)}
      />
      <input type="file" onChange={handleFileChange} />
      <p>{uploadStatus}</p>
    </div>
  );
};

export default FileUploader;

Next.js

When using Next.js, you can create pages or components that utilize the package. Since Next.js supports both server-side and client-side code, you should use the package on the client side (e.g., within components or pages rendered on the client).

Example Next.js Page for Sending an Email

// pages/send-email.js
import { useState } from 'react';
import EkiliRelay from 'ekilirelay';

export default function SendEmailPage() {
  const [apiKey, setApiKey] = useState('');
  const [message, setMessage] = useState('');
  const relay = new EkiliRelay(apiKey);

  const handleSubmit = async (e) => {
    e.preventDefault();
    if (!apiKey) {
      setMessage("Please enter your API key.");
      return;
    }
    try {
      const response = await relay.sendEmail(
        '[email protected]',
        'Test Subject',
        'This is a test message.',
        'From: senderName <[email protected]>'
      );
      setMessage(response.status === 'success' ? "Email sent successfully." : `Failed: ${response.message}`);
    } catch (error) {
      setMessage(`Error: ${error.message}`);
    }
  };

  return (
    <div style={{ maxWidth: '600px', margin: '2rem auto', padding: '1rem' }}>
      <h1>Send Email</h1>
      <form onSubmit={handleSubmit}>
        <input
          type="text"
          placeholder="Enter your API key"
          value={apiKey}
          onChange={(e) => setApiKey(e.target.value)}
          style={{ width: '100%', padding: '0.5rem', marginBottom: '1rem' }}
          required
        />
        <button type="submit">Send Email</button>
      </form>
      <p>{message}</p>
    </div>
  );
}

Example Next.js Page for Uploading a File

// pages/upload-file.js
import { useState } from 'react';
import EkiliRelay from 'ekilirelay';

export default function UploadFilePage() {
  const [apiKey, setApiKey] = useState('');
  const [uploadMessage, setUploadMessage] = useState('');
  const relay = new EkiliRelay(apiKey);

  const handleFileChange = async (e) => {
    const file = e.target.files[0];
    if (!apiKey) {
      setUploadMessage("Please enter your API key.");
      return;
    }
    if (!file) {
      setUploadMessage("No file selected.");
      return;
    }
    setUploadMessage("Uploading...");
    try {
      const result = await relay.uploadFile(file);
      setUploadMessage(result.status === 'success' ? `Uploaded: ${result.filename}, URL: ${result.url}` : `Upload failed: ${result.message}`);
    } catch (error) {
      setUploadMessage(`Error: ${error.message}`);
    }
  };

  return (
    <div style={{ maxWidth: '600px', margin: '2rem auto', padding: '1rem' }}>
      <h1>Upload File</h1>
      <input
        type="text"
        placeholder="Enter your API key"
        value={apiKey}
        onChange={(e) => setApiKey(e.target.value)}
        style={{ width: '100%', padding: '0.5rem', marginBottom: '1rem' }}
        required
      />
      <input type="file" onChange={handleFileChange} />
      <p>{uploadMessage}</p>
    </div>
  );
}

API Reference

new EkiliRelay(apiKey: string)

Creates a new instance of the EkiliRelay package.

  • Parameters:
    • apiKey: Your EkiliRelay API key used for authenticating requests.

sendEmail(to: string, subject: string, message: string, headers?: string): Promise<{ status: string; message: string }>

Sends an email using the provided details.

  • Parameters:
    • to: Recipient's email address.
    • subject: Email subject.
    • message: Email body.
    • headers (optional): Additional email headers.
  • Returns: A promise that resolves with the API response.

uploadFile(file: File): Promise<{ status: string; message: string; [key: string]: any }>

Uploads a file to the EkiliRelay storage endpoint.

  • Parameters:
    • file: The file to be uploaded.
  • Returns: A promise that resolves with the upload result (e.g., filename and URL).