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

@magicstoreai/storefront-client

v0.6.0

Published

Typed client for the MagicStore Storefront API v2 — Node, edge and browser

Readme

@magicstoreai/storefront-client

Typed client for the MagicStore Storefront API v2. One method per operationId, types generated from the published OpenAPI document. No React, no Node-only APIs: it runs in Node (≥ 22), edge runtimes and the browser.

import { createStorefrontClient, MagicStoreError } from '@magicstoreai/storefront-client';

const client = createStorefrontClient({
  shopDomain: 'shop.example.uz', // or baseUrl
  storefrontToken: process.env.MAGICSTORE_STOREFRONT_TOKEN, // when the host is not the shop's domain
  locale: 'uz',
  customerToken: () => session.accessToken, // read on every call — it rotates hourly
});

const { data: product } = await client.productsShow({ path: { handle: 'red-shoes' } });

for await (const item of client.paginate('productsIndex', { query: { sort: '-createdAt' } })) {
  // every product, page after page
}

try {
  await client.checkoutsCompletion({ path: { id: checkoutId } });
} catch (error) {
  if (error instanceof MagicStoreError && error.code === 'CHECKOUT_NOT_READY') {
    // error.errors, error.detail (localized), error.requestId
  }
}

What the client does for you

| | | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Headers | X-Storefront-Token, Accept-Language, Authorization: Bearer <customer>, X-Request-Id (generated) | | Idempotency | Money-moving calls (checkout completion, payment link, reward redemption, ambassador payout) get an Idempotency-Key. To retry one whose answer you did not get, pass { idempotencyKey: error.idempotencyKey }. | | Errors | Every non-2xx answer throws MagicStoreError with the API's code; no answer is NETWORK_ERROR, a cancelled call ABORTED, a 2xx whose body does not parse INVALID_RESPONSE (with the real status). | | Bodies | JSON answers are parsed. An operation the spec answers in another type is sent Accept for it and resolves to the text: feedsMetaCatalog() → the XML feed as a string. | | Retries | GETs answered 429 / 5xx or not answered: 2 retries with jittered backoff, honouring Retry-After. Writes are never retried. retry: false turns it off. | | Pagination | client.paginate(operationId, input) — offset (page) and cursor (cursor) operations alike. |

Every method takes (input, options?): input has path, query, header and body exactly as the operation declares them; options are signal, locale, customerToken, idempotencyKey, requestId and headers for that one call.

Resource types by name: Schema<'Product'>, Schema<'Cart'>, …

The API itself — rules, errors, auth, cart and checkout — is documented in the backend repository under docs/api/v2/.