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

zelapi

v0.0.3

Published

Universal JavaScript & TypeScript client for ZelApi — simple, secure, and flexible HTTP requests with support for JSON, text, and media responses.

Downloads

251

Readme

ZelApi

ZelApi is a powerful and versatile JavaScript/TypeScript library that simplifies HTTP requests to the ZelApi service. It's designed to be easy to use, with support for universal parameters, different response types, and a secure way to handle your API key.

Features

  • Universal Parameters: Pass parameters as an object or a single string.
  • Multiple Response Types: Handle JSON, text, and buffer (for images, videos, etc.) responses with ease.
  • Secure API Key Handling: Your API key is sent securely in the request headers.
  • TypeScript Support: Written in TypeScript for a better developer experience.
  • Easy to Use: A simple and intuitive API that gets the job done.

Installation

You can install zelapi using npm or yarn:

# Using npm
npm install zelapi

# Using yarn
yarn add zelapi

How to Use

ZelApi now offers two clients: ZelApiv1 and ZelApiv2.

  • ZelApiv1: Connects to zelapioffciall.koyeb.app. It's free to use and does not require an API key.
  • ZelApiv2: Connects to zelapioffciall.dpdns.org. It requires an API key for authenticated access.

ZelApiv1 Usage (No API Key)

Here's a simple example using ZelApiv1:

import { ZelApiv1 } from "zelapi";

// Initialize the v1 client (no API key needed)
const zel = new ZelApiv1();

async function getCat() {
  try {
    const res = await zel.json("/random/cat");
    console.log(res);
  } catch (error) {
    console.error("Error fetching cat:", error);
  }
}

getCat();

ZelApiv2 Usage (API Key Required)

To use ZelApiv2, you must provide an API key.

import { ZelApiv2 } from "zelapi";

// Initialize the v2 client with your API key
const zel = new ZelApiv2({
  apiKey: "YOUR_API_KEY",
});

async function getDog() {
  try {
    const res = await zel.json("/random/dog");
    console.log(res);
  } catch (error) {
    console.error("Error fetching dog:", error);
  }
}

getDog();

Universal Parameters

You can pass parameters as an object or a single string.

Object Parameters

import { ZelApi } from "zelapi";

const zel = new ZelApi();

async function search() {
  try {
    const res = await zel.json("/search", {
      q: "nature",
      type: "image",
    });
    console.log(res);
  } catch (error) {
    console.error("Error searching:", error);
  }
}

search();

String Parameter

If you pass a string as the second argument, it will be treated as the text parameter.

import { ZelApi } from "zelapi";

const zel = new ZelApi();

async function convert() {
  try {
    const res = await zel.json("/convert/to-emoji", "Hello World");
    console.log(res);
  } catch (error) {
    console.error("Error converting:", error);
  }
}

convert();

Handling Different Response Types

ZelApi can handle different response types, such as JSON, text, and buffers.

JSON Response

The json() method returns a JSON object.

const res = await zel.json("/random/cat");
console.log(res);

Text Response

The text() method returns a string.

const res = await zel.text("/random/quote");
console.log(res);

Buffer Response

The buffer() method returns a Buffer, which is useful for handling images, videos, and other binary files.

import { ZelApi } from "zelapi";
import fs from "fs";

const zel = new ZelApi();

async function getCatImage() {
  try {
    const buffer = await zel.buffer("/random/cat-image");
    fs.writeFileSync("cat.jpg", buffer);
    console.log("Cat image saved!");
  } catch (error) {
    console.error("Error fetching cat image:", error);
  }
}

getCatImage();

Contributing

Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct before submitting a pull request.

Security

If you discover a security vulnerability, please report it to us by following the instructions in our Security Policy.

License

This project is licensed under the MIT License.