Skip to main content

Core Concepts

Architecture

The SDK operates as a headless-first layer between your React Native app and two Shopify APIs:
  • Stackfront REST API — managed services (loyalty, reviews, stories, push notifications, events, billing, config). Handled by the ApiClient service.
  • Shopify Storefront GraphQL API — commerce primitives (products, cart, checkout, customer, orders). Handled by the StorefrontClient service.
The SDK abstracts this so your code never needs to know which API is being called.

Provider & Context

Wrap your root component in StackfrontProvider. On mount, it fetches remote config, initializes all services, and exposes them via React context. All hooks and services access this context through the useStackfront() hook:

Services vs Hooks

The SDK provides two layers of API: Services — direct imperative access to underlying functionality (API calls, storage, GraphQL queries). Accessible via useStackfront(). Hooks — opinionated React wrappers over services with built-in state management (data, loading, error). Prefer hooks for most UI work.

Available Hooks (25)

Available Services (15)

GraphQL Operations

The SDK bundles pre-written GraphQL queries and mutations for the Shopify Storefront API. These are used internally by the ProductService, CartService, and CustomerService, and are also exported directly:
Available operations:

Lifecycle

  1. App starts → StackfrontProvider mounts
  2. Config fetched from Stackfront API (storefront token, OneSignal ID, feature flags)
  3. Storefront GraphQL client initialized
  4. Storage initialized (AsyncStorage)
  5. OneSignal initialized if configured
  6. ready = true
  7. app_opened event tracked
  8. App renders
Access ready and error from useStackfront() to gate your UI: