Spree Commerce
Open-source headless ecommerce platform with a REST API and Next.js storefront
Alternative to: Shopify, Magento, WooCommerce, Salesforce Commerce Cloud
spree/sdk@1.0.0
2026-04-11@spree/sdk 1.0.0 — Official TypeScript SDK for Spree
The official TypeScript SDK for Spree Commerce Store API v3 is now stable!
@spree/sdk gives TypeScript and JavaScript developers a fully typed, ergonomic client for building storefronts on top of Spree. It ships as the recommended way to interact with the Store API - whether you’re using the Next.js storefront, building your own, or integrating Spree into any frontend or mobile framework.
npm install @spree/sdk
Highlights
- Full Store API v3 coverage — products, cart, checkout, orders, payments, customer accounts, wishlists, categories, markets, and geography
- Payment Sessions API — provider-agnostic payment flow that works with Stripe, Adyen, PayPal, and any gateway through a single interface
- Markets support — multi-market resolution, per-market countries, automatic currency/locale handling
- Complete TypeScript types — generated from API serializers, covering all Store API resources, request params, and response shapes
- Three auth modes — publishable key (guest), JWT (authenticated customer), and order token (guest checkout)
- Resource builder pattern — intuitive nested resources (client.store.orders.lineItems.create(…))
- Custom fetch support — bring your own fetch implementation for SSR, edge runtimes, or testing
- Structured error handling — typed SpreeError with status codes, error codes, and validation details
- Dual CJS + ESM bundles — works everywhere via tsup
- Tested with MSW — network-level API mocking with Vitest and E2E against real Spree instance
Quickstart
import { createClient } from '@spree/sdk';
const client = createClient({
baseUrl: 'https://demo.spreecommerce.org',
publishableKey: 'pk_xxx',
});
const products = await client.products.list({
limit: 10,
expand: ['variants'],
fields: ['name', 'price', 'slug']
});