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

@reserp/sdk

v0.4.1

Published

Official minimal JavaScript and TypeScript SDK for the Reserp Google Search API v2

Readme

Reserp JavaScript and TypeScript SDK

npm version CI License: MIT

The official minimal JavaScript and TypeScript client for Reserp v2, a Google Search API with two stable response shapes:

Website · API documentation · OpenAPI 3.1 · Postman · Pricing

Design

Each SDK call makes exactly one API request and returns the native Fetch Response unchanged. The package adds no retry, timeout, URL-building, validation, pagination, transformation, cache, batch, queue, or concurrency policy. It has zero runtime dependencies and supports ESM and CommonJS.

Installation

npm install @reserp/sdk

Node.js 20 or later is required.

Search results

import { Reserp } from "@reserp/sdk";

const reserp = new Reserp({ apiKey: process.env.RESERP_API_KEY });
const response = await reserp.search({
  url: "https://www.google.com/search?q=best+pizza+in+dubai&gl=ae&hl=en",
});
const data = await response.json();

if (data.ok) {
  for (const item of data.results) console.log(item.text, item.url);
} else {
  console.error(response.status, data.error, data.retryable, data.billed);
}

The deprecated urls() method is a compatibility alias for search() and uses the stable Search endpoint.

Structured results

const response = await reserp.structured({
  url: "https://www.google.com/search?q=wireless+earbuds&gl=us&hl=en&tbm=shop",
});
const data = await response.json();

if (data.ok) {
  for (const block of data.blocks) {
    console.log(block.position, block.type, block.title);
  }

  for (const block of data.blocks.filter((block) => block.type === "organic")) {
    for (const item of block.items) {
      console.log(item.position, item.title, item.url);
    }
  }
}

The generated TypeScript declarations cover every block and item family in the canonical OpenAPI schema. Narrow on block.type to access type-specific fields.

Native transport control

The second argument is passed to Fetch after the SDK supplies the method, authorization header, content type, and JSON body:

const response = await reserp.search(
  { url: "https://www.google.com/search?q=semiconductors&gl=us&hl=en&tbs=qdr:w" },
  {
    signal: AbortSignal.timeout(20_000),
    redirect: "manual",
    headers: { "x-request-id": "your-job-id" },
  },
);

You can inject a Fetch-compatible transport with the constructor's fetch option. Transport failures remain native Fetch errors. HTTP error responses remain native responses; inspect the status, headers, and JSON body.

Direct HTTP equivalents

curl https://api.reserp.ai/v2/serp/search \
  --request POST \
  --header "Authorization: Bearer $RESERP_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"url":"https://www.google.com/search?q=photonic+computing&gl=us&hl=en"}'

curl https://api.reserp.ai/v2/serp/structured \
  --request POST \
  --header "Authorization: Bearer $RESERP_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"url":"https://www.google.com/search?q=photonic+computing&gl=us&hl=en"}'

Pagination and errors

Every successful response contains pagination.next_url. Send that URL back as the next request body's url; its presence does not guarantee that another page contains results. Do not calculate pagination from results.length, blocks.length, or any block's item count.

Error bodies expose error, message, doc_url, retryable, billed, and billing_source. Use message and doc_url for diagnostics; message wording may change, so branch on the stable error code and retryable flag. If your application retries, use retryable as the authority and honor Retry-After on HTTP 429. The SDK never retries automatically.

Migrating

From SDK 0.3, replace urls() with search(), /v2/serp/urls with /v2/serp/search, and data.urls with data.results. urls() remains as a deprecated method alias, but its response now follows the stable Search contract.

If you used the structured beta, replace schema_version, grouped results, features, page_position, and metadata with the stable, page-ordered blocks[] model. Each block has type and position; block-specific entries live in items[].

When migrating directly from v1, other notable renames are urlrequest.url, finalUrlpage.url, pagination.nextUrlpagination.next_url, and billingSourcebilling_source.

License

MIT