spree-storefront
Installation
SKILL.md
Spree Storefront (Next.js)
The Spree Next.js storefront is a separate app that talks to the Spree backend over the v3 Store API (/api/v3/store/*) using @spree/sdk 2.x. create-spree-app puts it in apps/storefront/ (next to server/ and apps/dashboard/); or fork https://github.com/spree/storefront. Next.js 16, React 19, Tailwind 4.
The storefront is optional — any frontend (Astro, Remix, React Native, …) can use the same Store API. This skill assumes the official storefront; the API contract is identical for any client.
Architecture — server-first
Browser → Server Action (src/lib/data/*) → @spree/sdk → Spree Store API
httpOnly cookies (JWT, refresh token, cart token, country/locale) via src/lib/spree helpers
- All API calls run server-side (Server Actions / Server Components in
src/lib/data/). The browser never calls Spree directly; even the publishable key stays server-only (SPREE_PUBLISHABLE_KEY, noNEXT_PUBLIC_). src/lib/spree/holds the integration:getClient(), cookie helpers,withAuthRefresh(),getLocaleOptions(),getCartOptions(), middleware, surfaces (DTC vs wholesale), webhooks.- Client components (
CartContext,CheckoutContext, …) hold UI state and call Server Actions — don't add SWR/React Query fetches against the Store API from the browser.