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

trendsapi

v1.0.1

Published

Official JavaScript/TypeScript client for the Trends API. Normalized 0-100 trend scores across Google, TikTok, Amazon, Reddit, YouTube, Steam, npm and 30+ sources. Zero runtime deps, dual ESM/CJS, edge-ready.

Readme

trendsapi (JavaScript / TypeScript)

Official JS/TS client for Trends API. Node 18+, Deno, Bun, Workers. Zero runtime dependencies. Three methods. Decoded payloads. You never parse the HTTP body string.

HTTP contract and field tables: trendsapi-ai/trendsapi.

License: MIT npm Runtime

Authentication

npm install trendsapi
export TRENDSAPI_KEY=your_key

Key: trendsapi.ai/#get-key (100 calls/month on free).

import { TrendsAPI } from "trendsapi";

const client = new TrendsAPI({ apiKey: process.env.TRENDSAPI_KEY! });

Methods

| Method | REST mode | Required | Returns | |---|---|---|---| | getTimeSeries | get_time_series | source, keyword | weekly points | | getGrowth | get_growth | source, keyword | growth object | | getTopTrends | get_top_trends | type | live feed |

const series = await client.getTimeSeries({ source: "youtube", keyword: "air fryer" });
const growth = await client.getGrowth({
  source: "google shopping",
  keyword: "air fryer",
  percentGrowth: ["3M", "12M"],
});
const chart = await client.getTopTrends({ type: "App Store Top Free", limit: 25 });

Typed source and type are separate unions. source: "Google Trends" is a type error (and a 400 on raw POST).

getTimeSeries

const points = await client.getTimeSeries({ source: "google search", keyword: "bitcoin" });

| Field | Always | Meaning | |---|---|---| | date | yes | YYYY-MM-DD | | value | yes | 0-100 index | | keyword | yes | Echo | | volume | no | Absolute volume when available | | source or datatype | no | Pipeline label |

getGrowth

const g = await client.getGrowth({
  source: "google search",
  keyword: "nike",
  percentGrowth: ["12M", "3M", "YTD"],
});

Default window: ["12M"]. Presets: 7D 14D 30D 1M 2M 3M 6M 9M 12M/1Y 18M 24M/2Y 36M/3Y 48M 60M/5Y MTD QTD YTD. Custom: { name: "Launch", recent: "2024-06-01", baseline: "2024-01-01" }.

| Field | Meaning | |---|---| | search_term | Keyword | | data_source | Source | | results | Per-window growth, direction, dates, values | | metadata | Counts / success flag |

getTopTrends

const hot = await client.getTopTrends({ type: "GitHub Trending Repos", limit: 5 });

| Field | Meaning | |---|---| | as_of_ts | Snapshot time | | type | Feed name | | limit, offset, count | Pagination | | data | [rank, label] rows |

Optional offset, category (Amazon Best Sellers by Category, Top Websites only).

Keyword sources

Pass as source. Details: hub README.

| source | keyword | |---|---| | google search, google images, google news, google shopping | Any phrase | | youtube | Any phrase | | tiktok | Hashtag or topic | | reddit | Subreddit, no r/ | | amazon | Product phrase | | wikipedia | Article title | | news volume, news sentiment | Any phrase | | app downloads, app rankings | Android bundle ID (com.openai.chatgpt) | | npm | Exact package name | | steam | Game display name |

Live feeds

Pass as type. Exact strings: Google Trends, Google News Top News, TikTok Trending Hashtags, TikTok Trending Searches, TikTok Shop Hot Products, YouTube Trending, X (Twitter) Trending, Reddit Hot Posts, Reddit World News, Wikipedia Trending, Amazon Best Sellers Top Rated, Amazon Best Sellers by Category, App Store Top Free, App Store Top Paid, Google Play, Top Websites, Spotify Top Podcasts, Steam Most Played, GitHub Trending Repos, IMDb MOVIEmeter, Open Library Trending Books.

Next.js / Workers

Uses global fetch. Bind TRENDSAPI_KEY as a secret.

import { TrendsAPI } from "trendsapi";

export async function GET(req: Request) {
  const keyword = new URL(req.url).searchParams.get("q") ?? "air fryer";
  const client = new TrendsAPI({ apiKey: process.env.TRENDSAPI_KEY! });
  const [search, shopping, video] = await Promise.all([
    client.getGrowth({ source: "google search", keyword, percentGrowth: ["12M"] }),
    client.getGrowth({ source: "google shopping", keyword, percentGrowth: ["12M"] }),
    client.getGrowth({ source: "youtube", keyword, percentGrowth: ["12M"] }),
  ]);
  return Response.json({ keyword, search, shopping, video });
}

Three 200s, three quota units.

export default {
  async fetch(_req: Request, env: { TRENDSAPI_KEY: string }) {
    const client = new TrendsAPI({ apiKey: env.TRENDSAPI_KEY });
    return Response.json(await client.getTopTrends({ type: "GitHub Trending Repos", limit: 5 }));
  },
};
import type { TimeSeriesPoint, GrowthResponse, TopTrendsResponse } from "trendsapi";

Errors

| Code | Client | |---|---| | 200 | Resolves parsed payload | | 400 | Throws. Fix field names | | 401 | Throws. Check TRENDSAPI_KEY | | 404 | Throws. No series. Do not retry | | 429 | Throws. Quota | | 5xx | Retries, then throws |

Raw fetch (second parse required): hub, Raw HTTP.

License

MIT. See LICENSE.