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

apifetch-cli

v1.0.0

Published

A fast, zero-dependency CLI tool for testing REST APIs from the terminal. Pretty-prints JSON, shows status codes, response times, and headers.

Readme

apifetch

A fast, zero-dependency CLI tool for testing REST APIs from the terminal. Like a simpler curl with pretty-printed output, colored JSON, status codes, and response times.

Install

npm install -g apifetch-cli

Usage

apifetch [METHOD] <url> [options]

The method defaults to GET, or POST if a body is provided with -d.

Examples

Simple GET

apifetch https://jsonplaceholder.typicode.com/posts/1

Output:

  200 OK  42ms  281 B

  GET https://jsonplaceholder.typicode.com/posts/1

  ────────────────────────────────────────────────────────────

  {
    "userId": 1,
    "id": 1,
    "title": "sunt aut facere ...",
    "body": "quia et suscipit ..."
  }

POST with JSON Body

apifetch POST https://jsonplaceholder.typicode.com/posts \
  -d '{"title":"Hello","body":"World","userId":1}'

PUT / PATCH / DELETE

apifetch PUT https://api.example.com/users/1 -d '{"name":"Jane"}'
apifetch PATCH https://api.example.com/users/1 -d '{"name":"Jane"}'
apifetch DELETE https://api.example.com/users/1

Custom Headers

apifetch GET https://api.example.com/me \
  -H "Authorization: Bearer mytoken" \
  -H "Accept: application/json"

Query Parameters

apifetch https://api.example.com/users -q "page=1&limit=10"

Save Response to File

apifetch https://api.example.com/data -o response.json

Verbose Mode (Show Response Headers)

apifetch GET https://api.example.com/status -V

Options

| Flag | Description | |------|-------------| | -d, --data <body> | Request body (JSON string) | | -H, --header <header> | Add header ("Key: Value"), repeatable | | -q, --query <params> | Query parameters ("key=val&key2=val2") | | -o, --output <file> | Save response body to file | | -t, --timeout <secs> | Request timeout in seconds (default: 30) | | -V, --verbose | Show response headers | | --raw | Print raw response without JSON formatting | | --no-follow | Don't follow redirects | | -h, --help | Show help | | -v, --version | Show version |

Features

  • Zero dependencies — pure Node.js, nothing to install beyond Node itself
  • Pretty JSON — responses are syntax-highlighted with colors
  • Status at a glance — color-coded status badges (green 2xx, blue 3xx, yellow 4xx, red 5xx)
  • Response time — see how long the request took
  • Auto-detect content type — JSON bodies get application/json automatically
  • Follow redirects — follows up to 5 redirects by default
  • Pipe-friendly — colors are automatically disabled when output is piped
  • Helpful errors — friendly messages for DNS failures, connection refused, SSL issues

Supported Methods

GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS

Exit Codes

| Code | Meaning | |------|---------| | 0 | Success (1xx, 2xx, 3xx, 4xx) | | 1 | Error (network failure, invalid URL, timeout) | | 2 | Server error (5xx response) |

License

MIT