Getting started

1. Install

bash

bashCopy
npm install @aiminaabeejs/js-sdk @aiminaabeejs/types

2. Create the client

Use a publishable key for browser/mobile clients. Never ship a secret API key to the storefront.

ts

tsCopy
import Aiminaabee from "@aiminaabeejs/js-sdk"
const sdk = new Aiminaabee({
baseUrl: "https://api.aiminaabee.com",
publishableKey: process.env.NEXT_PUBLIC_PUBLISHABLE_KEY,
auth: {
type: "jwt",
jwtTokenStorageMethod: "local",
},
})

3. Auth modes

Use JWT mode (default) for SPAs that store a bearer token client-side. Use session mode when the API exchanges the token for an HTTP-only cookie — set fetchCredentials: "include" when the API is on another origin.

ts

tsCopy
import Aiminaabee from "@aiminaabeejs/js-sdk"
const sdk = new Aiminaabee({
baseUrl: "https://api.aiminaabee.com",
publishableKey: process.env.NEXT_PUBLIC_PUBLISHABLE_KEY,
fetchCredentials: "include",
auth: {
type: "session",
},
})

4. List products

GET /store/:storeCode/products

First Store API call via the SDK.

ts

tsCopy
const { products, count } = await sdk.store.product.list("us", {
limit: 20,
offset: 0,
})
console.log(products, count)

For a full walkthrough of listing products, carts, checkout, and customer accounts, see Storefront Development. For React Native and Expo, see Mobile Development.