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

@storeos/storefront-client

v0.0.2

Published

TypeScript SDK for the StoreOS Storefront REST API (v1).

Readme

@storeos/storefront-client

The official TypeScript SDK for StoreOS storefronts. Browse products, manage customer accounts, and run checkout — with full types and zero runtime dependencies.

Works anywhere fetch runs: React, Next.js, Remix, React Native, Cloudflare Workers, Node 18+.

Install

npm install @storeos/storefront-client
yarn add @storeos/storefront-client
pnpm add @storeos/storefront-client
bun add @storeos/storefront-client

Quick start

import { StoreFront } from '@storeos/storefront-client';

const store = new StoreFront({
  tenant: 'your-store-id',
});

const { nodes: products, meta } = await store.getProducts({
  page: 1,
  limit: 24,
});

const product = await store.getProduct({ handle: 'blue-widget' });

Configuration

const store = new StoreFront({
  /** Your StoreOS store identifier */
  tenant: 'your-store-id',

  /** Optional — restore a session from storage */
  accessToken: sessionToken,

  /** Optional — custom fetch for tests or edge runtimes */
  fetch: customFetch,
});

Customer sessions

Sign-in methods automatically keep the session on the client. Persist the token in your app and restore it on load:

await store.login({
  user: '[email protected]',
  password: '••••••••',
});

// Save store.getAccessToken() to cookies, localStorage, etc.

store.setAccessToken(savedToken);
const me = await store.getMe();

Phone OTP is supported too:

await store.sendOtp({ phoneNumber: '+8801…' });
await store.verifyOtp({ phoneNumber: '+8801…', otp: '123456' });

What you can build

Catalog

await store.getTenant();
await store.getProducts({ search: 'shirt', collectionIds: ['…'] });
await store.getProduct({ handle: 'linen-shirt' });
await store.getCollections();
await store.getCollection('collection-id');

Checkout

const coupon = await store.verifyCoupon({
  code: 'SAVE10',
  lineItems: [{ productId: '…', quantity: 2 }],
});

const { order } = await store.createOrder({
  lineItems: [{ productId: '…', quantity: 2 }],
  shippingAddress: { /* … */ },
  paymentMethod: 'COD',
  couponCode: coupon.valid ? 'SAVE10' : undefined,
});

Guest checkout works out of the box. If the API returns a token, the client picks it up so the customer can track the order immediately.

Order history

const { nodes: orders } = await store.getMyOrders({ page: 1 });
await store.getOrder('order-id');
await store.cancelOrder('order-id', 'Changed my mind');

Pagination

List methods return { nodes, meta }:

const { nodes, meta } = await store.getProducts({ page: 2, limit: 12 });

meta.totalCount;
meta.hasNextPage;
meta.totalPages;

Supported query params: page, limit, sort, sortBy, search, and collectionIds (products).

Errors

Non-2xx responses throw StoreFrontApiError with status, message, and body:

import { StoreFront, StoreFrontApiError } from '@storeos/storefront-client';

try {
  await store.getProduct({ handle: 'sold-out' });
} catch (error) {
  if (error instanceof StoreFrontApiError) {
    console.error(error.status, error.body);
  }
}

Types

Every method is fully typed. Import request and response shapes directly:

import type {
  Product,
  Collection,
  Order,
  StorefrontUser,
  CreateOrderInput,
  PaginatedResponse,
} from '@storeos/storefront-client';

API surface

| Area | Methods | |------|---------| | Store | getTenant | | Products | getProducts, getProduct, getProductById, getProductByHandle | | Collections | getCollections, getCollection | | Auth | getMe, register, login, logout, updateProfile, changePassword, sendOtp, verifyOtp | | Orders | getMyOrders, getOrder, createOrder, verifyCoupon, cancelOrder | | Session | getAccessToken, setAccessToken |

License

Private / see storeos.dev for terms.