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

@rekaz-io/storefront

v0.3.0

Published

Official TypeScript client and customer sessions for the Rekaz Storefront API

Readme

Rekaz Storefront API client

Use this TypeScript client to call the Rekaz Storefront API from your own storefront: the store's public configuration and catalog, customer sign-in, and the signed-in customer's carts, orders, bookings, and account. It has a method for each operation in the API reference. The package requires Node.js 24 or later.

pnpm add @rekaz-io/storefront

API client

The package has no root export. Import the API client from /api:

import { createStorefrontApiClient, isRekazProblemDetails } from "@rekaz-io/storefront/api";

const storefront = createStorefrontApiClient({
  accessToken: customerAccessToken,
  tenant: "my-tenant",
});
const { data, error } = await storefront.me.listOrders({ query: { limit: 20 } });

if (error) {
  throw new Error(isRekazProblemDetails(error) ? error.detail : "The request failed.");
}

Client options include baseUrl, headers, a Fetch-compatible fetch, and accessToken. The token can be a string or a provider called before each request. Keep customer tokens on the server; see customer sessions. Import operation and error metadata from @rekaz-io/storefront/api/catalog when you need the full catalog.

Hosted checkout runs at /checkout/{cartId} on the storefront's hostname (or /{tenant}/checkout/{cartId} on the shared Rekaz storefront). Its server exchanges the session token from the storefront's __Host-rekaz_customer_session cookie through the urn:rekaz:customer-session grant, then calls Rekaz's Me checkout endpoints with the resulting server-side bearer token. The cart ID identifies the cart; the customer token and ownership check authorize it.

List operations use cursor pagination. Pass nextCursor unchanged with the same filters and sort order; null marks the end. Request includeTotal only when the total count is needed.

Requests return data, error, request, and response by default. Pass throwOnError: true to throw on API errors. Operations that require an Idempotency-Key document the header. Generate a key with createIdempotencyKey() and reuse it when retrying the same operation.

Customer sessions

Public operations need only the store's tenant. Customer operations need an access token, which must stay on your server. Import the session manager from /session in server code. It signs customers in with a one-time code and keeps them signed in with the __Host-rekaz_customer_session cookie (HttpOnly, Secure, SameSite=Lax, 30 days). The cookie holds only an opaque session token, never an access token.

import { createIdempotencyKey, createStorefrontApiClient } from "@rekaz-io/storefront/api";
import { createCustomerSessionManager } from "@rekaz-io/storefront/session";

const sessions = createCustomerSessionManager({ tenant: "my-tenant" });

// Sign-in: send the code, then exchange it and set the returned cookie.
const challenge = await sessions.startOtp({ idempotencyKey: createIdempotencyKey(), mobileNumber });
const { setCookie } = await sessions.exchangeOtp({ challengeId: challenge.challengeId, code });

// Each request that calls customer operations.
const session = await sessions.resolve(request.headers.get("Cookie"));
if (session.status === "authenticated") {
  const storefront = createStorefrontApiClient({ accessToken: session.accessToken, tenant: "my-tenant" });
}
  • resolve exchanges the session token for a 15-minute access token. Call it once per incoming request and reuse the token for that request's calls.
  • Set the setCookie that resolve returns on your response. It keeps the cookie alive, or clears it when the session was revoked or expired.
  • logout revokes the session at Rekaz and returns the cookie that clears it.
  • The cookie is sent with any request to your origin. Before resolving it for a request that changes data, check that the request came from your own pages.
  • Failures throw CustomerSessionError. Its code is Rekaz's error code, such as invalid_otp_code, and retryable marks outages worth retrying.

License

See LICENSE for usage terms.