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

api-ulp

v1.0.2

Published

A lightweight Node.js client for the ULP Search API — search with a query, limit, and API key.

Readme

api-ulp

A lightweight Node.js client for the ULP Search API.
Wraps the POST /api/search endpoint with a clean, promise-based interface, full input validation, and descriptive error messages.


Installation

npm install api-ulp

Requirements

| Requirement | Version | |-------------|----------| | Node.js | >= 14.x | | axios | >= 1.6.0 |


Quick Start

const UlpClient = require('api-ulp');

const client = new UlpClient('YOUR_API_KEY');

client.search('target_data', 50)
  .then(results => console.log(results))
  .catch(err => console.error(err.message));

API Reference

new UlpClient(apiKey, [options])

Creates a new client instance.

| Parameter | Type | Required | Default | Description | |--------------------|----------|----------|----------|--------------------------------------| | apiKey | string | ✅ Yes | — | Your X-API-Key credentials | | options.timeout | number | ❌ No | 10000 | Request timeout in milliseconds |

const UlpClient = require('api-ulp');

const client = new UlpClient('YOUR_API_KEY', { timeout: 15000 });

createClient(apiKey, [options]) (factory helper)

An alternative to new UlpClient(...) — useful when you prefer a functional style.

const { createClient } = require('api-ulp');

const client = createClient('YOUR_API_KEY', { timeout: 15000 });

client.search(query, [limit])Promise<object>

Sends a POST request to /api/search and returns the parsed response body.

| Parameter | Type | Required | Default | Description | |-----------|----------|----------|---------|------------------------------------------| | query | string | ✅ Yes | — | The search query / target data string | | limit | number | ❌ No | 50 | Maximum number of results to return |

const results = await client.search('target_data', 25);
console.log(results);

Usage Examples

Basic search (async/await)

const UlpClient = require('api-ulp');

async function main() {
  const client = new UlpClient('YOUR_API_KEY');

  const results = await client.search('target_data', 50);
  console.log(results);
}

main();

Using the factory helper

const { createClient } = require('api-ulp');

const client = createClient('YOUR_API_KEY');

const results = await client.search('target_data', 10);
console.log(results);

Using default limit (50)

const UlpClient = require('api-ulp');

const client = new UlpClient('YOUR_API_KEY');

// limit defaults to 50 when omitted
const results = await client.search('target_data');
console.log(results);

Error handling

const UlpClient = require('api-ulp');

const client = new UlpClient('YOUR_API_KEY');

try {
  const results = await client.search('target_data', 50);
  console.log(results);
} catch (err) {
  console.error('Message :', err.message);

  // Only present on API (HTTP) errors:
  if (err.status)   console.error('HTTP Status :', err.status);
  if (err.response) console.error('API Response:', err.response);
}

Storing your API key safely with .env

Install dotenv:

npm install dotenv

Create a .env file in your project root:

ULP_API_KEY=your_real_api_key_here

Use it in your code:

require('dotenv').config();
const UlpClient = require('api-ulp');

const client = new UlpClient(process.env.ULP_API_KEY);

const results = await client.search('target_data', 50);
console.log(results);

⚠️ Never commit your .env file. Add it to .gitignore.


Error Types

| Scenario | err.message prefix | Extra properties | |-------------------------------------|-----------------------------------|---------------------------| | Missing / invalid API key | [api-ulp] A valid API key ... | — | | Invalid query argument | [api-ulp] "query" must be ... | — | | Invalid limit argument | [api-ulp] "limit" must be ... | — | | API responded with non-2xx status | [api-ulp] API error (STATUS): | err.status, err.response | | No response (network / timeout) | [api-ulp] No response received | — | | Request setup failure | [api-ulp] Request setup error: | — |