spree-typescript-sdk
Installation
SKILL.md
Spree TypeScript SDKs
| Package | Surface | Auth |
|---|---|---|
@spree/sdk |
Store API (/api/v3/store) |
Publishable key + optional customer JWT / guest token |
@spree/admin-sdk |
Admin API (/api/v3/admin) |
Secret key or staff JWT |
@spree/seller-sdk |
Seller API (/api/v3/seller) |
Seller JWT + seller ID (createSellerClient, setSeller). Singletons use get/update like the admin SDK (seller.me.get(), seller.me.update({ selected_locale }), seller.profile.update(…)). See spree-marketplace |
@spree/sdk-core |
Shared HTTP, retry, errors, extensions | Internal, never published. Don't import it |
The three SDKs version in lockstep with the Spree gems (6.0.3 alongside gems 6.0.3), so pin the SDK to your server's minor. @spree/cli versions on its own track (3.6.x for 6.0.3). All three expose the same shape and share SpreeError, retry, idempotency, a request escape hatch and extend().
@spree/sdk also ships three subpaths: @spree/sdk/types (generated types), @spree/sdk/zod (Zod schemas) and @spree/sdk/webhooks (signature verification, Node only). The Admin and Seller SDKs have matching /types and /zod subpaths. Schemas are named <Type>Schema and generated from the API serializers. zod (>= 3) is an optional peer dependency, so install it yourself to validate responses at runtime:
import { OrderSchema } from '@spree/admin-sdk/zod'
const order = OrderSchema.parse(await adminClient.orders.get('or_xxx')) // throws on a shape mismatch