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

@selorax/data

v0.1.2

Published

SeloraX data SDK — typed storefront reads (products, store, collections).

Readme

@selorax/data

Typed storefront data SDK for the SeloraX Pages platform — read products, the store, categories, and collections from the storefront API.

npm i @selorax/data

0.1.0 · pre-1.0 (expect 0.x minor bumps for breaking changes).

What it is

SeloraX Pages renders file-based storefronts (HTML/TSX) on a multi-tenant runtime. The data plane — products, the store, catalog — is served by the storefront API (/api/storefront/v1). @selorax/data is the typed client for that API: a set of small async read functions plus the TypeScript types for what they return.

It is one of the building blocks the @selorax/pages-cli and @selorax/runtime wire together, but it's a plain HTTP client with no SeloraX-runtime dependency, so you can use it standalone (e.g. in your own scripts or a custom renderer).

Usage

Reads take explicit context(apiUrl, auth) — there is no module-level singleton, so the same SDK is safe to use for many tenants in one process.

import { getStore, getProducts, getProduct, makeBoundSdk } from '@selorax/data';

const apiUrl = 'https://your-host/api/storefront/v1';
const auth = { storeId: 22, secretKey: 'sk_live_…' }; // a per-tenant secret key

const store = await getStore(apiUrl, auth);                       // → Store
const { items, meta } = await getProducts(apiUrl, auth, { page: 1 }); // → { items: ProductCard[], meta }
const product = await getProduct(apiUrl, auth, 'gan-fast-charger'); // → Product (by slug)

Auth (SeloraxAuth)

interface SeloraxAuth {
  storeId: number;
  secretKey?: string;    // per-tenant secret key (sk_…)  ← what most consumers use
  serviceToken?: string; // platform service token (+ X-Selorax-Store-Id header) — internal
}

Pass a secretKey for normal per-tenant access. serviceToken is the platform-internal mode.

Read functions

| Function | Returns | |---|---| | getStore(apiUrl, auth) | Store — name, settings, branding | | getProduct(apiUrl, auth, slug) | Product — price, variants, gallery | | getProducts(apiUrl, auth, opts?) | { items: ProductCard[]; meta: ListMeta } | | getBestsellers(apiUrl, auth, opts?) | bestseller feed (same shape) | | getCategories(apiUrl, auth) / getCategory(apiUrl, auth, slug) | category list / one category | | getCollections(apiUrl, auth) / getCollectionProducts(apiUrl, auth, slug, opts?) | collections / a collection's products |

All return types are exported (Store, Product, Variant, Sku, ProductCard, Category, Collection, ListMeta, ProductFeedOpts, …).

makeBoundSdk — arg-free reads for tenant code

When rendering a tenant page you don't want to thread (apiUrl, auth) through every call. makeBoundSdk binds them once and returns an SDK whose methods are arg-free — this is what the runtime hands to tenant TSX (import { getStore } from '@selorax/data' resolves to the bound instance):

import { makeBoundSdk } from '@selorax/data';
const sdk = makeBoundSdk({ apiUrl, auth });
const store = await sdk.getStore();           // no args
const product = await sdk.getProduct(slug);

Notes

  • No singleton / no global state — every read is explicit-context, so it's concurrency- and multi-tenant-safe.
  • Responses are unwrapped from the API's { data, … } envelope for you.
  • ESM only; ships compiled dist/ + .d.ts.

Part of SeloraX Pages

@selorax/data · @selorax/runtime · @selorax/platform · @selorax/compiler · @selorax/pages-cli