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

shorter.sh

v1.0.0

Published

CLI and SDK for the shorter.sh URL shortener

Readme

shorter.sh

CLI and SDK for the shorter.sh URL shortener. Zero runtime dependencies, Node >=18.

Installation

npm install shorter.sh

CLI

# First run will prompt for your API key
shorter https://example.com
# ✓ https://shorter.sh/xK9mP2
#   Copied to clipboard!

shorter list
shorter list --page 2 --limit 10

shorter delete xK9mP2
shorter delete xK9mP2 --yes

shorter analytics
shorter analytics xK9mP2
shorter analytics xK9mP2 --dimension country

shorter config set api-key sk_your_key_here
shorter config set base-url https://custom.domain
shorter config get api-key
shorter config path

Options

| Flag | Description | |------|-------------| | --no-copy | Don't copy short URL to clipboard | | --yes | Skip delete confirmation prompt | | --page N | Page number for list | | --limit N | Items per page for list | | --start DATE | Analytics start date (ISO or timestamp) | | --end DATE | Analytics end date (ISO or timestamp) | | --dimension DIM | Analytics breakdown: country, device_type, browser, os, referrer_domain, language | | -h, --help | Show help | | -v, --version | Show version |

Aliases

  • shorter lsshorter list
  • shorter rmshorter delete
  • shorter statsshorter analytics

Environment Variables

  • SHORTER_API_KEY — API key (overrides config file)
  • SHORTER_BASE_URL — Base URL (overrides config file)
  • NO_COLOR — Disable colored output

SDK

import { ShorterClient } from 'shorter.sh';

const client = new ShorterClient({
  apiKey: 'sk_your_key_here',     // or set SHORTER_API_KEY env var
  baseUrl: 'https://shorter.sh',  // optional
});

// Shorten a URL
const { shortCode, shortUrl, originalUrl } = await client.shorten('https://example.com');

// List your URLs
const { urls, pagination, totalClicks } = await client.list({ page: 1, limit: 50 });

// Delete a URL
await client.delete('xK9mP2');

// Analytics overview
const overview = await client.analytics.overview({ start: '2024-01-01', end: '2024-01-31' });

// Per-URL analytics
const stats = await client.analytics.url('xK9mP2', { dimension: 'country' });

// Detailed analytics (all breakdowns)
const detail = await client.analytics.url('xK9mP2', { detail: true });

Error Handling

import { ShorterClient, ValidationError, RateLimitError, NetworkError } from 'shorter.sh';

try {
  await client.shorten('not-a-url');
} catch (err) {
  if (err instanceof ValidationError) {
    console.log(err.message); // "Invalid URL"
    console.log(err.code);    // "INVALID_URL"
    console.log(err.status);  // 400
  }
}

Error classes: ShorterError (base), ValidationError, AuthenticationError, ForbiddenError, NotFoundError, RateLimitError, ServerError, NetworkError.

Custom Fetch

const client = new ShorterClient({
  apiKey: 'sk_...',
  fetch: myCustomFetch,  // inject for testing or custom behavior
});

License

MIT