Turbopush
Setup

Expo Setup Guide

Complete guide to setting up Turbopush OTA updates in your Expo React Native app.

Installation

npm install --save @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties

Expo Plugin Setup

  1. Add the following to your app.json or app.config.ts file:
Turbopush SDK requires a minimum deployment target of 15.5, if you're using a higher version, you can ignore the expo-build-properties plugin.
{
  "plugins": [
    [
      "expo-build-properties",
      {
        "ios": {
          "deploymentTarget": "15.5",
        },
      },
    ],
    [
      "@turbopush/turbopush-expo-plugin",
      {
        "android": {
          "CodePushDeploymentKey": "YOUR_ANDROID_CODE_PUSH_KEY", // generated in the create app step
        },
        "ios": {
          "CodePushDeploymentKey": "YOUR_IOS_CODE_PUSH_KEY", // generated in the create app step
        },
      }
    ]
  ]
}
For the sake of simplicity, we're using the deployment key hardcoded in the app.json file. However, we recommend using environment variables to store your deployment keys. e.g. process.env.EXPO_PUBLIC_TURBOPUSH_ANDROID_KEY and process.env.EXPO_PUBLIC_TURBOPUSH_IOS_KEY.

Prebuild

Run this command to generate the native code for your app.

npx expo prebuild

Basic JavaScript configuration

In your main app file:

import codePush from "@turbopush/react-native-code-push"; 

const App = () => {
  // Your app component
};

export default App; 
export default codePush(App); 

For advanced configuration, refer to the JavaScript API Reference.

6. First Release

Creating a Release (Expo)

Use the specific command that automatically generates the bundle:

npx turbopush release-expo myapp-ios ios "1.0.0"

or

npx turbopush release-expo myapp-android android "1.0.0"

Important release parameters

ParameterRequiredDefaultDescription
--deploymentName, -dNoStagingSpecifies the deployment
--description, --desNo-Description of changes
--mandatory, -mNofalseMarks as mandatory update
--rollout, -rNo100Sets rollout percentage

Example with parameters

npx turbopush release-expo myapp-ios ios "1.0.0" \
--deploymentName "Production" \
--description "Critical bug fixes" \
--mandatory \
--rollout 50

Read more about Releasing Updates.

How is this guide?