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

@ruuster/idx

v0.2.0

Published

TypeScript client for the Ruuster Listings API (idx.ruuster.com). Fetch-based, zero dependencies.

Downloads

821

Readme

@ruuster/idx

The TypeScript client for the Ruuster Listings API. It calls the API with fetch, types every answer from the API's own response schemas, and adds the helpers a listing site needs: head tags, listing URLs, JSON-LD, photo attributes, formatting, display rules and webhook verification. It has no dependencies and runs on Node.js 18.17 or later, on edge runtimes and, with your publishable key, in the browser.

The full guide, with every method and helper, is at https://help.ruuster.com/idx/guide-sdk.

Install

npm install @ruuster/idx

The package is plain JavaScript (ES modules) with its own TypeScript types and no dependencies, so it works as installed in any framework and in Node.js 18.17 or later.

Use it from a copy of this repository

To use the packages from a checkout of this repository instead of npm, point your project at their sources. In tsconfig.json, under compilerOptions:

{
  "paths": {
    "@ruuster/idx": ["../path/to/packages/ruuster-idx/src/index.ts"],
    "@ruuster/idx/*": ["../path/to/packages/ruuster-idx/src/*"],
    "@ruuster/idx-recipes": ["../path/to/packages/ruuster-idx-recipes/src/index.ts"]
  }
}

In next.config.mjs, let Next.js compile files outside your project folder with experimental: { externalDir: true }. The Next.js example in examples/idx-nextjs is set up this way.

Use it

Keep your secret key on your server, in IDX_SECRET_KEY:

import { createClient, fmt } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY, detailHref: "/homes/{slug}" });

const r = await idx.search({ city: "Atlanta", state: "GA", status: "active", limit: 12 });
if (!r.ok) throw new Error(`${r.status} ${r.error.code}: ${r.error.message}`);
for (const l of r.data.listings) console.log(fmt.usd(l.price), l.address.display, l.href);

In the browser, use your publishable key (NEXT_PUBLIC_IDX_KEY in Next.js). Creating a client with a secret key in a browser throws.

import { createClient } from "@ruuster/idx";

const idx = createClient({ publishableKey: process.env.NEXT_PUBLIC_IDX_KEY });
const s = await idx.suggest({ q: "Midtown", limit: 5 });
console.log(s.ok ? s.data.map((row) => row.label) : s.error.message);

Results, errors and retries

Every method answers { ok: true, status, data, meta, etag, headers } or { ok: false, status, error: { code, message, retryable }, requestId, headers }. After r.ok, meta is always there (only status() answers meta: null), so r.meta.mls needs no check. An HTTP error is a result, never a thrown error; a request that did not complete answers status 0 with network_error. A 429 or 503 with Retry-After of at most 10 seconds is retried up to twice.

search without view answers cards. On a page, spread fromSearchParams(searchParams) into the query, or type the query as Omit<SearchQuery, "view">; a variable typed as plain SearchQuery answers the union of cards, full records and map pins. similar answers { listing, why } items: pass r.data.listings.map((s) => s.listing) to a grid.

Methods

search, get, similar, suggest, boundary, market, mortgage, collectionListings, meta, ids (secret key), changes (secret key), publicRecords.lookup, publicRecords.history and publicRecords.market (secret key, with the Public Records add-on), status, and request(path, query) for every other endpoint.

Mortgage estimates

mortgage answers a monthly payment estimate for a price, line by line, at today's market rates. It works with either key and costs no daily units. Send the listing's HOA dues and yearly tax when you have them; a tax or insurance line you leave out is estimated and marked estimated in monthly.provenance. Show every line of requiredDisclosures under the estimate.

import { createClient } from "@ruuster/idx";

const idx = createClient({ publishableKey: process.env.NEXT_PUBLIC_IDX_KEY });
const m = await idx.mortgage({ price: 450000, state: "GA", downPaymentPercent: 20, hoaMonthly: 150, propertyTaxAnnual: 5400 });
if (m.ok) console.log(m.data.monthly.total, m.data.options.loanTypes, m.data.requiredDisclosures);

toMortgageQueryString(q) builds the same query string the client sends (the API's parameter order, numbers in their shortest form, null and undefined left out), so the same scenario always hits the same cached answer.

Public records

publicRecords is the Public Records add-on, for your server and your secret key. It answers one property at a time, to prepare a CMA or a listing presentation, and a fixed set of market figures for one area. It has no list and no search by owner.

import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });
const one = await idx.publicRecords.lookup({ parcelNumber: "14-0049-0003-021-7", postalCode: "30308", purpose: "listing_presentation", include: "owner" });
if (one.ok) console.log(one.data.record.address, one.data.record.owner?.names);
const market = await idx.publicRecords.market({ city: "Decatur", state: "GA" });
if (market.ok) console.log(market.data.area.postalCodes, market.data.measures.medianYearsOwned.value);

Listing Alerts

With the Listing Alerts add-on, idx.alerts manages buyers, saved searches and the alerts you send through your own email provider. Every method needs the secret key (server only).

import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });
const r = await idx.alerts.buyers.create({
  email: "[email protected]",
  firstName: "Jamie",
  consent: { text: "Email me new listings that match this search.", source: "https://www.example-homes.com/search" },
  search: { name: "Austin under 600k", criteria: { city: "Austin", state: "TX", priceMax: "600000" }, frequency: "daily" },
});

const queue = await idx.alerts.deliveries.list({ status: "pending" });
for (const d of queue.ok ? queue.data.items : []) {
  // send d.delivery through your email provider, then:
  await idx.alerts.deliveries.result(d.id, { status: "sent", providerMessageId: "msg-1" });
}

The groups are alerts.agents, alerts.buyers, alerts.searches, alerts.deliveries, alerts.settings, alerts.link(token), alerts.unsubscribe(token) and alerts.credits(). Lists answer { items, nextCursor }. Verify the alerts webhook with verifyWebhook. Guide: https://help.ruuster.com/idx/alerts-quickstart

Helpers

toMetadata, listingPath, parseListingSlug, serializeJsonLd, breadcrumbJsonLd, photoAttrs, fmt (usd, change, count, sqft, date, openHouse), fromSearchParams, fromWidgetSearchParams, widgetPropertyId, toQueryString, renderAttribution, assertDisplayable and verifyWebhook:

import { verifyWebhook } from "@ruuster/idx";

export async function POST(req: Request) {
  const v = await verifyWebhook({ body: await req.text(), headers: req.headers, secret: process.env.RUUSTER_WEBHOOK_SECRET ?? "" });
  if (!v.ok) return Response.json({ ok: false, error: v.reason }, { status: 401 });
  for (const e of v.events) console.log(e.kind, e.listing.id);
  return Response.json({ ok: true });
}

CRM

@ruuster/idx/crm sends the leads from your own forms to your Follow Up Boss, Sierra Interactive or Sure Send account from your server. Import it only in server code.

  • assertSendable(lead) throws LeadRejected (reason: honeypot, contact, consent or invalid, and a message to show) before any call.
  • Follow Up Boss: fub.eventFromLead(lead, { source, listing, listingUrl }), then fub.sendEvent(event, { apiKey, system, systemKey }, { fetch }). A registered visitor's views: fub.viewedPropertyEvent({ id }, listing, { source, listingUrl }).
  • Sierra Interactive: sierra.leadFromSubmission(lead, { source, listing, listingUrl }), then sierra.createLead(body, { apiKey }, { fetch }). Sierra needs an email.
  • Sure Send: suresend.personFromSubmission(lead, { source, listing, listingUrl, stage }), then suresend.createPerson(person, { apiKey }, { fetch }).
  • Every sender answers { ok: true, status, id } or { ok: false, status, error, retryAfterSec }. The fetch option lets a test send to a fake.
  • LeadSubmission, the body the recipe forms post, is exported from @ruuster/idx.

The whole guide is at https://help.ruuster.com/idx/guide-sdk and https://help.ruuster.com/idx/crm-overview.