StoreOSv0.15.0
TypeScript SDK

TypeScript SDK

What @storeos/storefront-client is — REST client and React SDK for StoreOS storefronts.

What is this package?

@storeos/storefront-client is an npm package that connects your storefront app to StoreOS. It ships two surfaces from the same package:

SurfaceImportTransportBest for
REST client@storeos/storefront-clientREST /api/v1Any runtime with fetch
React SDK@storeos/storefront-client/reactGraphQL + providers/hooksNext.js / React storefronts

Both surfaces send x-tenant, attach auth when present, and return typed data.


What the package does

AreaREST clientReact SDK
CataloggetProducts, getProduct, …GraphQL queries + gqlClient
Authlogin, register, OTP, …useAuth, cookie session helpers
Cart— (your app)useCart (localStorage)
CheckoutcreateOrder, verifyCouponMutations + Zod form schemas
OrdersgetMyOrders, cancelOrder, …Queries + server session helpers

What the package does NOT do

Your app's jobWhy it's yours
UI & pagesBranding, layout, design system
Deploy & domainHosting your storefront
Payment UICollecting card details for ONLINE orders

With the REST client alone, cart and session persistence are also yours. With the React SDK, cart and cookie-backed auth are included — you still build the UI around them.

Package vs your app

ConcernPackageYour app
HTTP / GraphQL to StoreOS
Tenant + auth headers
TypeScript types
React providers & hooks (React SDK)
Pages, routing, design
Deploy

Install

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

React SDK peers (when using /react):

npm install react react-dom @tanstack/react-query zod immer use-immer
# optional — Next.js App Router server helpers
npm install next

Quick starts

REST

// lib/store.ts
import { StoreFront } from "@storeos/storefront-client";

export const store = new StoreFront({
  tenant: process.env.NEXT_PUBLIC_SITE_API_TENANT!,
});

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

Default API host: https://storefront-api.storeos.dev.

React

"use client";

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { StoreOSProvider } from "@storeos/storefront-client/react";

const queryClient = new QueryClient();

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <QueryClientProvider client={queryClient}>
      <StoreOSProvider
        config={{
          tenant: process.env.NEXT_PUBLIC_SITE_API_TENANT!,
          siteUrl: process.env.NEXT_PUBLIC_SITE_URL,
        }}
      >
        {children}
      </StoreOSProvider>
    </QueryClientProvider>
  );
}

→ Full React setup: React SDK


Next steps

On this page