Getting Started
Create your storefront app, install the package, connect to StoreOS, and launch.
What you're building
A storefront app is the website your customers use — product pages, cart, checkout, login. StoreOS is the backend behind it. This guide connects the two.
You will:
- Create a frontend project (your repo)
- Install
@storeos/storefront-client(talks to StoreOS) - Point at the hosted API with your tenant UID
- Fetch catalog data and build pages
- Run and deploy your app
You will not: set up the StoreOS server, clone a monorepo, or use workspace:*.
What you need before starting
| Requirement | What it is |
|---|---|
| Tenant UID | Your store's ID on StoreOS — sent as x-tenant on every API call. From StoreOS onboarding. |
| Node.js 18+ or Bun | To run your storefront app |
| A frontend framework | Next.js is common; anything with fetch works |
Step 1 — Create your app
Your storefront lives in your own repository:
bun create next-app my-store
cd my-storeThis is where you build UI, routing, and branding. StoreOS only provides data via the API.
Step 2 — Install the package
@storeos/storefront-client wraps the StoreOS REST API — catalog, auth, checkout, orders — with typed methods.
bun add @storeos/storefront-clientStep 3 — Configure environment variables
Create .env.local:
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_SITE_API_TENANT=your-tenant-uid| Variable | Purpose |
|---|---|
NEXT_PUBLIC_SITE_API_TENANT | Your store — scopes all data |
NEXT_PUBLIC_SITE_URL | Your app's public URL |
Step 4 — Create a StoreOS client
One shared client for your app:
// lib/store.ts
import { StoreFront } from "@storeos/storefront-client";
export const store = new StoreFront({
tenant: process.env.NEXT_PUBLIC_SITE_API_TENANT!,
});The client knows your tenant and connects to the hosted StoreOS API automatically. Import store on any page that needs products, auth, or orders.
Step 5 — Make your first request
Catalog — list products for your shop page:
const { nodes: products } = await store.getProducts({ limit: 12 });Store config — delivery charges, policies:
const tenant = await store.getTenant();→ First API request — REST, GraphQL, and curl examples
Step 6 — Build pages and launch
| Page | API area | Methods / routes |
|---|---|---|
| Home / shop | Catalog | getProducts, getCollections |
| Product detail | Catalog | getProduct({ handle }) |
| Login / register | Auth | login, register, sendOtp |
| Checkout | Orders | verifyCoupon, createOrder |
| Order history | Orders | getMyOrders |
bun dev # your app on localhost:3000
# API is already live at storefront-api.storeos.devDeploy to Vercel, Cloudflare, or your host. Your app keeps calling StoreOS over HTTPS.
→ Guides · SDK methods
Choose how to call the API
| Path | When |
|---|---|
| TypeScript SDK | Recommended — less boilerplate, full types |
| REST | Any language, or you want raw HTTP |
| GraphQL | Flexible queries, GraphQL stack already in place |