Turbopush

Getting Started

Learn how to set up Turbopush and ship your first OTA update to a React Native or Expo app in minutes.

Welcome to Turbopush! This guide will teach you how to do the initial Turbopush setup and perform your first release.

Want to test immediately?

We have a pre-built Expo example app ready for you to test OTA updates in minutes, without any setup. Just scan a QR code and start testing!

1. CLI Installation

First, install the Turbopush CLI in your project:

npm install --save-dev @turbopush/cli

Verify the installation was successful:

npx turbopush --version

2. Account Creation

If you don't have an account yet, create one at https://app.turbopush.org/sign-up.

3. Authentication

To start using Turbopush, you need to log in:

npx turbopush login

This command will:

  1. Open your browser for authentication
  2. Generate an access key
  3. Prompt you to paste the key in the terminal

To verify you're logged in:

npx turbopush whoami

3.1 Set your default organization

npx turbopush org set <organization-slug>

If you don't know your organization slug, you can list all your organizations with:

npx turbopush org list

4. Registering Your Application

Create separate apps for iOS and Android, this ensures each platform has appropriate update packages.

iOS

npx turbopush app add MyApp-iOS --appSlug myapp-ios

Android

npx turbopush app add MyApp-Android --appSlug myapp-android

The appSlug is used to identify the app in the CLI and API for publishing and managing releases. If not provided, the slug will be generated from the app name.

After creating the app

The command will return deployment keys for Staging and Production. Write down these keys, you'll need them to configure your React Native app, example:

┌────────────┬─────────────────────────────────────┐
 Name Deployment Key
├────────────┼─────────────────────────────────────┤
 Production dk_19ffa8fc2a91f2cd9afb3bfecafef06d
├────────────┼─────────────────────────────────────┤
 Staging dk_5g5dc7aa6197c1f292cd12ca28f39bb3
└────────────┴─────────────────────────────────────┘

5. SDK Configuration

Installation

npm install --save @turbopush/react-native-code-push

iOS Setup

  1. Run cd ios && pod install && cd .. to install all the necessary CocoaPods dependencies. ​
  2. Change bundleUrl on AppDelegate file.
  • Add an import statement for the CodePush headers;

  • Find the following line of code, which sets the source URL for bridge for production release and replace it with the following line;

    import React
    import CodePush
    
    override func bundleURL() -> URL? {
    #if DEBUG
       RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
    #else
      Bundle.main.url(forResource: "main", withExtension: "jsbundle") 
      CodePush.bundleURL() 
    #endif
    }
  1. Add the CodePushDeploymentKey key (generated in the create app step):
<key>CodePushDeploymentKey</key>
<string>YOUR_IOS_DEPLOYMENT_KEY</string>
  1. Certifies that your deployment_target is 15.5 or higher:
platform :ios, '15.5'

Android Setup

  1. Add this line at the end of the file:
apply from: "../../node_modules/@turbopush/react-native-code-push/android/codepush.gradle"
  1. Update the MainApplication file to use CodePush via the following changes:

    For React Native 0.76 and above:

    import com.facebook.react.ReactHost
    import com.facebook.soloader.SoLoader
    import com.microsoft.codepush.react.CodePush 
    
    class MainApplication : Application(), ReactApplication {
        override val reactNativeHost: ReactNativeHost =
          object : DefaultReactNativeHost(this) {
              override fun getJSBundleFile(): String { 
                return CodePush.getJSBundleFile()  
              } 
        };
    
        override fun onCreate() {
          super.onCreate()
          val deploymentKey = getString(R.string.CodePushDeploymentKey) 
          CodePush.getInstance(deploymentKey, this, BuildConfig.DEBUG) 
          loadReactNative(this)
        }
    }
  2. Add the CodePushDeploymentKey key (generated in the create app step):

<string name="CodePushDeploymentKey">YOUR_ANDROID_DEPLOYMENT_KEY</string>

Basic JavaScript configuration

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 (React Native)

For React Native, use the specific command that automatically generates the bundle:

npx turbopush release-react myapp-ios ios -t "1.0.0"

or

npx turbopush release-react myapp-android android -t "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
--targetBinaryVersion, -tNoauto-detectedSets the target binary version

Example with parameters

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

Read more about Releasing Updates.

Troubleshooting

Binary version error

Make sure the version specified in the release corresponds to the version in Info.plist (iOS) or build.gradle (Android).

App not receiving updates

  1. Verify deployment keys are correct
  2. Make sure codePush.sync() is being called
  3. Check device logs

Now you're ready to start using Turbopush!

For version 0.75 and below or CodePushServerURL usage

For version 0.75 and below, you need to use the old react-native-code-push instead of the new @turbopush/react-native-code-push package.

This is not supported in expo projects.

npm install --save react-native-code-push

In ios/[ProjectName]/Info.plist, you need to add the following:

<key>CodePushServerURL</key>
<string>https://api.turbopush.org</string>

And in android/app/src/main/res/values/strings.xml, you need to add the following:

<string name="CodePushServerURL">https://api.turbopush.org</string>

How is this guide?