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

@topchased/catalog-client-sdk

v1.0.1

Published

SDK for communicating with the Catalog Engine API - a language binding for frontend applications

Readme

@TopChased/catalog-client-sdk

SDK for communicating with the Catalog Engine API — a language binding for frontend applications.

Inspired by the TCGdex JavaScript SDK, this SDK provides a fluent, type-safe interface for querying catalog items (TCG cards, video games, consoles, etc.) from the Catalog Engine microservice.

Works in both Node.js and browser environments.

Installation

Build Locally

npm cache clean --force
rm -rf node_modules package-lock.json
npm install
# Create the package to later reference and build from
npm pack
npm install /path/to/catalog/client
# or
yarn add /path/to/catalog/client
# or
pnpm add /path/to/catalog/client

Publish

npm publish --access public

Quick Start

Add the package to your projct

npm install @topchased/catalog-client-sdk
import { CatalogClient } from '@topchased/catalog-client-sdk';

// Create a client pointing to your Catalog Engine API
const client = new CatalogClient('http://localhost:3001/api/v1');

// Search for Pokemon cards
const results = await client.search()
  .query('charizard')
  .category('tcg')
  .brand('pokemon')
  .language('en')
  .paginate(1, 20)
  .execute();

console.log(results.items); // Array of catalog items
console.log(`Found ${results.total} results`);

API Reference

CatalogClient

The main SDK class. Create an instance with the base URL of your Catalog Engine API.

const client = new CatalogClient('http://localhost:3001/api/v1');

client.search()SearchQueryBuilder

Create a fluent search query. Chain filters and call .execute() to run.

const results = await client.search()
  .query('charizard')          // Search text
  .category('tcg')             // tcg | video_game | video_game_consoles
  .brand('pokemon')            // pokemon | yugioh | one_piece
  .productType('card')         // card | sealed_product
  .language('en')              // Card language
  .setName('Base Set')         // Filter by set name
  .setCode('base1')            // Filter by set code
  .illustrator('Ken Sugimori') // Filter by illustrator
  .platform('nintendo-switch') // For video games/consoles
  .paginate(1, 20)             // Page number, items per page
  .limit(5)                    // Limit number of items returned
  .sort('title', 'asc')        // Sort field and order
  .execute();

client.searchWithFilters(filters)CatalogSearchResponse

Search using a plain object of filters.

const results = await client.searchWithFilters({
  q: 'charizard',
  category: 'tcg',
  brand: 'pokemon',
  limit: 20,
});

client.getItem(id)CatalogItem | null

Get a single catalog item by its ID.

const item = await client.getItem('abc123');
if (item) {
  console.log(item.title);
}

client.listItems(filters?)CatalogSearchResponse

List catalog items with optional filters (no text search).

const results = await client.listItems({
  category: 'tcg',
  brand: 'pokemon',
  limit: 50,
});

client.autocomplete(q, category?, brand?)AutocompleteSuggestion[]

Get autocomplete suggestions for a search query.

const suggestions = await client.autocomplete('char', 'tcg', 'pokemon');

Query Builder (standalone)

You can also use the standalone Query class to build query parameters:

import { Query } from '@topchased/catalog-client-sdk';

const query = Query.create()
  .search('charizard')
  .category('tcg')
  .brand('pokemon')
  .language('en')
  .paginate(1, 20)
  .sort('title', 'asc');

// query.params contains the key-value pairs

Type Guards

The SDK includes type guards for narrowing catalog item types:

import { isPokemonCatalogItem, isVideoGameCatalogItem } from '@topchased/catalog-client-sdk';

if (isPokemonCatalogItem(item)) {
  console.log(item.brand); // 'pokemon'
  console.log(item.details.hp); // Pokemon-specific fields
}

Response Types

CatalogSearchResponse

interface CatalogSearchResponse {
  items: CatalogItem[];
  total: number;
  page: number;
  limit: number;
  hasMore: boolean;
}

CatalogItem (union type)

  • PokemonCatalogItem — TCG cards with brand: 'pokemon'
  • YugiohCatalogItem — TCG cards with brand: 'yugioh'
  • OnePieceCatalogItem — TCG cards with brand: 'one_piece'
  • VideoGameCatalogItem — Video games with category: 'video_game'
  • ConsoleCatalogItem — Consoles with category: 'video_game_consoles'

Browser Usage

The SDK works in the browser out of the box. It auto-detects the environment and uses window.fetch when in a browser context.

Script Tag

<script src="https://unpkg.com/@catalog/client/dist/index.browser.global.js"></script>
<script>
  const client = new CatalogClient('http://localhost:3001/api/v1');
  client.search()
    .query('charizard')
    .category('tcg')
    .execute()
    .then(results => console.log(results));
</script>

ES Module

import { CatalogClient } from '@topchased/catalog-client-sdk';

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Type check
npm run typecheck

Creating Package for Install

npm run build
npm pack

To install locally to other repos:

# point to tar ie
npm add ../catalog-client-sdk/topchased-catalog-client-1.0.0.tgz

License

MIT