Skip to main content
The SDK provides a built-in React hook and works seamlessly with Next.js for both client-side rendering and server-side rendering.

Next.js Starter Template

Full example storefront built with Next.js, TypeScript, and the Storefront SDK.

React Hook

The SDK exports a useStorefrontSDK hook that memoizes the SDK instance:

Next.js Server-side Rendering

Use the SDK in getServerSideProps or server components with HMAC authentication:

Pages Router (getServerSideProps)

App Router (Server Components)

API Routes

Cart Context Example

A common pattern is to wrap cart state in a React context:

Environment Variables