Skip to main content

Requirements

  • React Native — built and tested against React Native 0.83
  • @tanstack/react-query (v5)
  • @react-native-async-storage/async-storage
  • react-native-device-info
  • react-native-onesignal

Installation

If you use Expo, install the required dependencies after adding the SDK:

Getting your API key

API keys are issued per merchant — there is no developer signup and no claim code.
  1. In your Shopify admin, open Stackfront → Settings → API key.
  2. Copy the key and your shop domain.
  3. Give both to whoever is building your mobile app — the SDK sends them on every request.
Need to hand over access again later? Use Rotate key on the same page. The old key keeps working for 7 days so a release in progress never breaks mid-flight.

Quick Start

Wrap your app’s root component in StackfrontProvider. This initializes the SDK, fetches the remote configuration, and makes all services available through context hooks.
App.tsx

StackfrontProvider Props

What Happens on Init

When StackfrontProvider mounts, the SDK automatically:
  1. Fetches remote config — retrieves your storefront access token, OneSignal app ID, and feature flags from the Stackfront API.
  2. Initializes the Storefront GraphQL client — connects to Shopify’s Storefront API using the fetched token.
  3. Initializes local storage — sets up AsyncStorage for wishlist and event caching.
  4. Initializes OneSignal — if an OneSignal app ID is configured, OneSignal is initialized and the device is registered. No permission prompt is shown; call usePush().requestPermission() at an appropriate moment.
  5. Tracks the app_opened event — sends a lifecycle event to the analytics pipeline.
  6. Sets ready to true — only then does your UI render.
Access the initialized state via the useStackfront() hook:

Next Steps