Learn Expo · 11/11

Deployment and Expo Application Services (EAS)

8 min read

Course: Expo

Topic: Deployment and Expo Application Services (EAS)

Hey there! So you've built a fantastic app with Expo. Users are going to love it! But... how do you actually get it from your computer onto their phones? 🤔 This is where things can get a little... hairy. You have to wrestle with native build tools, cryptic error messages, and the dreaded app store submission process.

Fear not! This is the problem that Expo Application Services (EAS) was created to solve.

What is EAS?
EAS is a set of cloud services for Expo and React Native apps that takes the pain out of the most complicated parts of app development: building, updating, and submitting your app to the official stores. Think of it as your personal DevOps team, handling all the grunt work so you can focus on what you do best—building awesome features.

Let's dive into the services that make up the EAS suite.


1. Introduction to EAS: Provisioning Profiles and Keystores 📜🔑

The Problem: Before you can even think about putting your app on the Apple App Store or Google Play Store, they need to know who you are. They won't just let any random app onto their platform. They require your app to have a verifiable, cryptographic identity. This process involves creating and managing special files that act as your app's official ID card and secret keys.

For iOS, this is a Provisioning Profile. For Android, it's a Keystore. Manually creating and managing these can feel like trying to get a visa for a country that doesn't exist. It's confusing, and if you lose them, you're in big trouble.

The Solution: EAS Manages Your App's Identity
EAS dramatically simplifies this. It can automatically generate, manage, and securely store these credentials for you.

  • Android Keystore: This is a file that contains cryptographic keys. You use a key from the keystore to "sign" your Android app. This signature acts as a guarantee that the app came from you and hasn't been tampered with. It's like the wax seal on a royal decree—it proves authenticity. If you lose your keystore, you can't update your app. Ever. It’s a pretty big deal, which is why letting EAS handle it is a popular choice.

  • iOS Provisioning Profile: This is a file that links three things together: your developer identity, your app's unique ID, and the specific devices it can run on (for testing) or its permission to be on the App Store. It’s Apple's way of controlling who can build what. Getting all the certificates and identifiers to line up correctly is a classic headache for iOS developers.

How EAS Helps:
When you're ready to build your app, EAS will ask if you want it to handle the credentials. If you say yes, it will create them and store them securely in your Expo account. No more hunting for files on your hard drive or worrying about losing your keys.

bash
# When you run the build command for the first time
eas build

# EAS CLI will prompt you:
# For Android:
# "Would you like to upload a keystore or have us generate a new one for you?"
# For iOS:
# "Would you like to have us generate new credentials for you?"

Just let EAS do its thing, and you can forget about this whole complicated business. It's a true lifesaver.


2. EAS Build: Compiling Your App in the Cloud ☁️🏗️

The Problem: Your beautiful JavaScript/TypeScript code is understood by React Native, but your phone's operating system (iOS or Android) doesn't speak JavaScript directly. It needs a compiled, native application package. For Android, that's an APK or an AAB file. For iOS, it's an IPA file.

Creating these files on your own computer can be a nightmare. For iOS builds, you must have a macOS machine. For both platforms, you need to install and configure specific native development tools like Xcode and Android Studio. It's a fragile setup where one wrong update can break everything.

The Solution: EAS Build
EAS Build is a cloud service that compiles these native packages for you. You just push your code to Expo's servers, and their powerful, pre-configured machines handle the entire build process.

Getting Started with EAS Build:

  1. Install the EAS CLI: This is the command-line tool you'll use to interact with all EAS services.

    bash
    npm install -g eas-cli
  2. Log in to your Expo account:

    bash
    eas login
  3. Configure your project: This command creates a crucial file in your project called eas.json. This file tells EAS Build how to build your app.

    bash
    eas build:configure

Your eas.json file might look something like this:

json
{
  "build": {
    "production": {},
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    }
  }
}

This file defines different "profiles." For example, the development profile is configured to build a special "development client," which is super useful for testing, while the production profile is for building the app you'll send to the stores.

Running a Build:
To build your app for Android, you simply run:

bash
eas build --platform android

For iOS:

bash
eas build --platform ios

EAS will zip up your project, upload it, and put it in a queue. You'll get a link to watch the build progress in real-time. Once it's done, you'll get a downloadable link for your shiny new IPA or AAB file. No need to own a Mac or worry about your local setup! ✨


3. EAS Update: Fixing Bugs at Lightning Speed ⚡️OTA

The Problem: You've just released your app. Thousands of people download it. Then, you spot a tiny, embarrassing typo on the welcome screen. Or maybe a small bug that crashes the app in a very specific scenario. Do you have to fix it, rebuild the entire app, and go through the whole App Store/Google Play review process again, which can take days? That's a huge delay for a small fix.

The Solution: EAS Update
EAS Update allows you to send updates for the JavaScript-based parts of your app directly to users' devices, bypassing the app stores. This is called an Over-the-Air (OTA) update.

How does it work?
Think of your Expo app as two parts:

  1. The Native Shell: The compiled IPA/AAB you built with EAS Build. This contains the native code, like the Expo Go engine, that knows how to run a React Native app. This part rarely changes.
  2. The JavaScript Bundle: All of your app's logic, UI, and assets. This is where you spend most of your development time.

When a user opens your app, the native shell checks with Expo's servers to see if there's a new JavaScript bundle available. If there is, it downloads it in the background and uses it the next time the app starts. It's like a web browser silently refreshing a webpage.

Publishing an Update:
It's incredibly simple. After you've fixed your bug or typo, just run:

bash
eas update

The CLI will ask you what changes you made (e.g., "Fixed typo on home screen"), bundle up your JavaScript, and publish it. The next time your users open the app, they'll get the fix. It's almost magical.

Important Note: You can only update your JavaScript code and assets this way. If you need to add a new native module or change a native configuration, you'll have to submit a new build to the app stores.


4. EAS Submit: Your Robot Assistant for App Stores 🤖📤

The Problem: You've built your app with EAS Build. It's perfect. Now comes the final boss: submitting it to the Apple App Store and Google Play Store. This is a manual, click-heavy process. You have to log in to their respective developer portals, fill out forms, upload your build file, manage screenshots, write release notes... it's tedious and easy to make a mistake.

The Solution: EAS Submit
EAS Submit automates this entire process. From your command line, you can tell EAS to take your finished build and submit it directly to the stores.

How it Works:
You provide EAS with your app store credentials (it helps you create a secure connection that doesn't require giving them your main password). Then, you run the command:

bash
# To submit the latest build for a specific platform
eas submit --platform ios

or

bash
eas submit --platform android

EAS will find your latest build from EAS Build, connect to the App Store Connect or Google Play Console API, and upload everything for you. It will even ask for your release notes right in the terminal.

You can configure eas.json to manage different submission environments (e.g., submitting to beta testing tracks like TestFlight or Google Play's internal testing track).

A typical eas.json configuration for submit might look like this:

json
{
  "submit": {
    "production": {
      "android": {
        "serviceAccountKeyPath": "./google-service-account.json",
        "track": "production"
      },
      "ios": {
        "appleId": "[email protected]",
        "ascAppId": "your-app-store-connect-app-id",
        "appleTeamId": "your-apple-team-id"
      }
    }
  }
}

Setting this up once saves you countless hours and clicks in the long run.

Congratulations! You now know how to use the full power of Expo Application Services to take your app from development to deployment like a pro.


Additional Resources 📚

Challenge

You are the lead developer for a new React Native application built with Expo. Your task is to configure the eas.json file to manage different build and submission workflows for your team. Configure the file to meet the following specifications:

Build Configuration (build)

  1. production Profile:

    • This profile is for releases to the public app stores.
    • It should use an update channel named production-v1.
    • For Android, it must generate an Android App Bundle (aab).
    • For iOS, set the distribution method for the App Store.
  2. preview Profile:

    • This profile is for internal QA testing.
    • It should use an update channel named staging.
    • Define a global environment variable APP_VARIANT with the value preview.
    • For Android, it must generate a standard APK (apk).
    • For iOS, configure it for internal distribution (e.g., for team testing) and enable automatic build number incrementing.
  3. development Profile:

    • This profile is for developers to create local development clients.
    • Enable the developmentClient option.
    • For iOS, specify the simulator build type.
    • Define a specific environment variable API_URL and set it to http://192.168.1.100:3000.

Submission Configuration (submit)

  1. production Profile:

    • This profile will be used to submit the production builds.
    • For Android, configure it to use the production track in the Google Play Store.
    • For iOS, specify a service account key path (serviceAccountKeyPath) at ./secrets/google-service-account.json.
  2. beta_release Profile:

    • This profile is for submitting builds to beta testers.
    • For Android, it should target the beta track in the Google Play Store.
    • For iOS, it should also submit to the App Store but include a specific release note: "Beta release for new feature testing.".

Expected result

Your eas.json file should be a valid JSON object containing two top-level keys: build and submit.

Under the build key, you should have three nested objects for the profiles: production, preview, and development. Each profile object should contain the specific configurations requested, such as channel, env, distribution, android.buildType, ios.buildNumber, and developmentClient where appropriate.

Under the submit key, you should have two nested objects for the profiles: production and beta_release. Each profile should contain platform-specific (android and ios) submission configurations, including the track for Android and serviceAccountKeyPath or releaseNotes for iOS as specified in the instructions.

json

Solve the challenge, then check it.

Ctrl+Enter

Course complete!

You've passed every challenge in this course.