@spree/sdk
v1.2.1
Published
Official TypeScript SDK for Spree Commerce Store API
Maintainers
Readme
@spree/sdk
Official TypeScript SDK for the Spree Commerce Store API v3 — fully typed resource clients, guest and customer authentication, carts and checkout, with runtime Zod schemas generated from the API's serializers.
Installation
npm install @spree/sdkQuick Start
import { createClient } from '@spree/sdk';
const client = createClient({
baseUrl: 'https://api.mystore.com',
publishableKey: 'spree_pk_xxx',
});
// Browse the catalog
const products = await client.products.list({ limit: 10, expand: ['variants', 'media'] });
// Cart + checkout
const cart = await client.carts.create();
await client.carts.items.create(cart.id, { variant_id: 'var_abc123', quantity: 2 }, { spreeToken: cart.token });
// Customer authentication (JWT)
const { token } = await client.auth.login({ email: '[email protected]', password: 'password123' });
const orders = await client.customer.orders.list({}, { token });Documentation
The full guides live on the docs site — this README intentionally stays short:
- SDK quickstart
- Authentication — publishable key, customer JWT + refresh, guest cart tokens
- Configuration — retries, custom fetch, error handling
- Store resources — products, cart & checkout, payments, account, wishlists, markets
- Extending the client — custom endpoints
- Store API reference
License
MIT
