EAS preview build profiles

You can configure an EAS preview profile that embeds a reachable HTTPS API URL and produces an internally distributed APK for real-device testing.

Learning outcomes

  • Explain how EAS build profiles separate development, preview and production configuration.
  • Configure a preview build with an internally distributed APK and a publicly reachable HTTPS API URL.
  • Validate API URLs and detect exposed credentials in build environment variables.
  • Prepare deterministic canteen data and operating accounts without storing authentication credentials.
  • Collect real tester feedback and prioritize bug fixes using severity and distinct reporter counts.

The Expo app can complete an order while connected to your development environment, but that does not prove a standalone Android application will work on somebody else's phone. A preview build contains the JavaScript bundle and the API URL selected when you build it. Your testers cannot automatically access your laptop's localhost or development network.

You need to package the application, configure its connection to the backend, distribute it, and observe what happens when people use it without your help.

Preview builds outside Expo Go

Development and standalone applications

During development, you usually run the Expo development server and open the application through Expo Go or a development client.

Expo Go loads your application while communicating with the development server. You can change JavaScript code and see the effects without generating a new standalone Android package.

A release application works differently.

Its JavaScript bundle is packaged with the native Android application. The installed application can start without an active development server.

This difference matters for three reasons:

  • The application must contain the correct API URL when you build it.
  • Native dependencies must work in the compiled application.
  • The tester must be able to reach your backend from their own network.

A successful session in Expo Go is not evidence that the standalone application works correctly.

EAS Build

EAS Build is Expo's build service for producing native Android and iOS application binaries.

You provide an Expo project and a build profile. EAS uses the configuration to prepare and compile the native application.

You can generate different application builds from the same source code:

  • Development builds support development workflows, including development clients.
  • Preview builds are release-like applications distributed to internal testers.
  • Production builds are prepared for public distribution.

This course uses a preview build. You do not need to publish the application to Google Play to test it with friends.

APK and Android App Bundle

Android has two important application package formats.

APK (Android Package Kit) is an installable Android application package. You can download an APK and install it directly on an Android device.

This installation process is called APK sideloading. The application is installed outside the normal app store distribution process.

AAB (Android App Bundle) is a publishing format intended for app stores. Google Play uses the bundle to generate optimized APKs for different devices.

The distinction is important:

FormatPurpose
APKDirect installation and internal testing
AABApp store publishing

For this course, you need an APK. You want somebody to download the application, install it and start using it without going through an app store.

EAS build profiles

Configuration separation

An EAS build profile describes how Expo should produce a particular application build.

Expo reads the profiles from eas.json at the root of your Expo project. In this repository, that file is app/eas.json.

The three profiles serve different purposes.

Development profile

Your development application needs to communicate with your laptop or another development server on the local network.

For example:

EXPO_PUBLIC_API_URL=http://192.168.1.20:8080

The development profile uses:

  • developmentClient: true
  • distribution: internal
  • An HTTP LAN API URL

Your phone must be able to reach the development machine over the network. The address localhost refers to the device itself, not your laptop.

Preview profile

Your preview application must work independently of the development environment.

Its configuration includes:

json
{
  "distribution": "internal",
  "android": {
    "buildType": "apk"
  },
  "env": {
    "EXPO_PUBLIC_API_URL": "https://api.example.com"
  }
}

The important settings are:

  • distribution: internal enables internal distribution.
  • android.buildType: apk produces an installable APK.
  • EXPO_PUBLIC_API_URL points to an HTTPS backend.

The preview API URL must be reachable from the testers' devices. A LAN address is not sufficient.

Production profile

The production profile prepares the application for its eventual public release.

It must use an HTTPS API URL and should configure autoIncrement: true for automatic version increments.

Keep the three profiles explicit. They represent different application environments, and changing one should not silently change the assumptions of another.

The Expo CLI configuration also belongs in eas.json. The supplied configuration checks use an Expo CLI version declaration of >= 16.0.0.

For this course, put the preview API URL directly inside the preview profile's env object. The configuration checker inspects build.preview.env.EXPO_PUBLIC_API_URL rather than resolving inherited environment values.

Build-time environment variables

Public environment configuration

Your application needs to know which backend it should contact.

A common approach is to read the configured URL:

typescript
const apiUrl = process.env.EXPO_PUBLIC_API_URL;

Expo supports public environment variables through the EXPO_PUBLIC_ prefix.

These variables are inlined into the JavaScript bundle during the build process.

For example, when EAS generates the preview APK, it uses the API URL configured for the preview profile. The resulting application contains that value.

Changing eas.json afterward does not change an APK that somebody has already installed. The installed application continues using the value in its existing bundle.

To distribute a different API URL, you need another build.

Public variables and secrets

There is an important security consequence.

Anything prefixed with EXPO_PUBLIC_ must be treated as public information. A person who has access to the application can inspect its bundled JavaScript and extract these values.

An API URL is expected to be public. Database passwords, JWT signing keys, private API credentials and administrator tokens are not.

Keep private credentials on the backend. The mobile application should authenticate through the existing authentication flow rather than carrying backend signing keys or database credentials.

API URL validation

Different profiles have different transport requirements.

Development may use HTTP because the phone and development server can communicate over a local network. Preview and production must use HTTPS.

The API URL should be validated at a single configuration boundary rather than allowing every API client to interpret environment values independently.

The exercise places that boundary in app/lib/eas.ts.

Its apiUrlFor function receives two inputs:

  • An environment object containing EXPO_PUBLIC_API_URL.
  • A Profile value identifying development, preview or production.

This is important. The helper uses the supplied environment object rather than directly depending on the global process environment. That makes the URL validation independently testable.

Consider these inputs:

ProfileConfigured URLExpected result
developmenthttp://192.168.1.20:8080/Accept
previewhttps://api.example.comAccept
productionhttps://api.example.comAccept
previewhttp://api.example.comReject

The helper must also handle malformed values.

A useful validation sequence is:

  1. Retrieve EXPO_PUBLIC_API_URL.
  2. Reject a missing or whitespace-only value.
  3. Trim surrounding whitespace.
  4. Remove trailing slashes.
  5. Parse the cleaned value as an absolute URL.
  6. Reject embedded usernames and passwords.
  7. Require HTTPS outside development.
  8. Return the cleaned input string.

The distinction between the parsed URL and the returned string matters.

The JavaScript URL constructor provides properties such as protocol, username and password. You can use these properties for validation without returning the constructor's normalized href representation.

For example:

Input:
  "  https://api.example.com//  "

Returned value:
  "https://api.example.com"

A URL containing embedded credentials must also be rejected:

https://admin:hunter2@api.example.com

The error should identify the problem using the word credentials.

A preview URL using HTTP should produce an informative error containing https. Similarly, a missing URL should produce an error containing EXPO_PUBLIC_API_URL.

These error messages are part of the contract. They make configuration failures easier to identify and allow the supplied tests to verify the intended failure.

EAS configuration validation

Checking a URL is not enough. The build configuration itself can be incorrect.

For example, a preview profile might exist but generate an Android App Bundle instead of an APK. Another profile might accidentally contain an administrator token.

The second exported function in app/lib/eas.ts is checkEasConfig.

It accepts unknown, not a trusted configuration type. This means you must inspect the input defensively.

Start with the overall configuration:

json
{
  "cli": {
    "version": ">= 16.0.0"
  },
  "build": {
    "preview": {}
  }
}

The checker needs to establish that the configuration is an object and that the build configuration exists before inspecting its profiles.

It then checks the preview profile.

The required preview properties are:

PropertyRequired value
build.previewMust exist
build.preview.distributioninternal
build.preview.android.buildTypeapk
build.preview.env.EXPO_PUBLIC_API_URLNon-empty HTTPS URL

Missing nested objects must not cause the checker to crash. For example, a missing android object should be reported as a configuration problem rather than causing an attempt to read android.buildType from an undefined value.

The checker also scans environment variable names across every build profile.

The following name patterns indicate possible secrets, regardless of capitalization:

  • SECRET
  • TOKEN
  • PASSWORD
  • PRIVATE
  • API_KEY

Every detected problem must contain the lowercase word secret.

Do not flag EXPO_PUBLIC_API_URL. It is intentionally public and is required for the application to contact the backend.

The checker returns an array of problem descriptions. A valid configuration produces an empty array.

This gives you two separate protections:

  • apiUrlFor validates the URL used by the application.
  • checkEasConfig validates the structure and security of the EAS build configuration.

Neither replaces the other.

Pre-build validation

Expo Doctor

Before generating a binary, validate the Expo project.

Run the following command from app/:

bash
npx expo-doctor@latest

Expo Doctor checks for common configuration and dependency problems.

A development application can appear healthy even when its native dependencies are inconsistent. A standalone release build compiles native modules, which can reveal problems that do not appear during normal JavaScript development.

Common problems include:

  • Native module version mismatches: A package expects a version that is incompatible with the installed Expo SDK.
  • Duplicate dependencies: Multiple versions of a native dependency can create conflicts during compilation.
  • Configuration problems: The Expo configuration does not match the installed project dependencies.
  • Package compatibility: An installed package does not support the SDK version used by the project.

Investigate the reported problems before generating the preview build.

You can also check whether installed packages match the versions recommended by Expo:

bash
npx expo install --check

When a package needs a different version, prefer npx expo install package-name. Expo can select a compatible package version for the SDK instead of blindly installing the latest npm release.

Generating the preview build

Once the project configuration is ready, generate the APK using the preview profile.

bash
eas build -p android --profile preview

EAS reads app/eas.json, selects the preview configuration and generates the Android application package.

For the cloud build workflow, you need an Expo account. A free account is sufficient for this course.

When the build completes, EAS provides a build page containing the result and a download link.

The generated APK contains the application code and the configured preview API URL. It does not require an active Expo development server.

You can monitor the build status and download the artifact from the EAS build page.

Local Android builds

EAS is not the only way to generate a release APK.

You can also generate the native Android project and build it locally:

bash
npx expo prebuild --platform android
cd android
./gradlew assembleRelease

Another local release-build option is:

bash
npx expo run:android --variant release

The local Gradle workflow requires a working Android development environment, including the Android SDK and a compatible Java installation.

Both methods can produce a release application. Neither changes the requirement that the preview application must use an HTTPS API endpoint reachable by testers.

APK installation and distribution

Installing the application

You can install the generated APK using Android Debug Bridge.

Connect your Android phone with USB debugging enabled and run:

bash
adb install path/to/your-app.apk

Android may also ask you to allow installation from the browser or file manager when you install the APK manually.

This is expected during sideloading.

Your tester does not need Expo Go, Node.js, Android Studio or access to the application's source code.

After installation, open the application and test the connection to the configured backend.

Check the complete ordering flow rather than stopping at the first screen.

Application updates

An APK is a compiled snapshot of your application.

Changing a component, API URL or configuration file does not update an application that somebody has already installed.

You must generate another APK and distribute the new artifact.

Android identifies an installed application using its package identifier and version code. To install an update over an existing application, the new build must have a higher versionCode.

The production profile uses autoIncrement: true for automatic version increments. When distributing repeated preview builds, make sure your versioning configuration also produces a higher Android version code for each update.

Selecting testers

A preview build is useful only when people other than its developer install and use it.

Choose five to ten people with Android devices.

They do not need to be experienced developers. People unfamiliar with the implementation are often better at revealing confusing interactions.

Send the APK link with a short explanation:

This is an early preview of my food-ordering application. Please install it, try placing an order and tell me where something breaks or feels confusing.

Avoid sending a lengthy document that explains every screen and every expected interaction.

You want testers to use the application naturally. Instructions that describe the intended behaviour can hide problems in the interface.

Observe what they do without helping them. Record the actions that cause confusion, the errors they encounter and whether they complete the intended workflow.

Realistic application data

The need for believable test data

A realistic demonstration requires realistic data.

If the application contains one restaurant, one menu item and incomplete opening hours, testers cannot exercise the actual ordering experience.

Prepare data that resembles a small operating food-delivery business.

Your seed dataset should describe a real canteen or restaurant. It should include its location, opening hours, menu items and operational users.

For the canteen package, the data should be deterministic. Calling canteen.Canteen() twice must return the same logical place.

The supplied acceptance tests check several properties:

DataRequirement
RestaurantNon-empty name and real coordinates
MenuAt least eight items across three categories
Item namesNon-blank and unique without regard to case
PricesPositive whole-rupee values represented in paise
Opening hoursValid minutes of the day with distinct opening and closing times
Operating usersAt least one restaurant user and one rider
EmailsValid and unique without regard to case
CredentialsNo passwords, secrets or tokens in seed data

The maximum permitted PricePaise is 100000. Every price must be divisible by 100.

For example, ₹120 is represented by 12000 paise, not 120.

Opening hours use minutes of the day, from 0 through 1439. An opening window can cross midnight, so a closing minute smaller than its opening minute is valid.

You should also leave part of the day closed. A canteen that appears open for all 24 hours does not represent the intended operating schedule.

Reusing the opening-hours index

You already have the Week 2 opening-hours implementation.

The canteen package should describe the opening windows and convert them into the existing hours.Slot representation.

The existing hours.Build and OpenAt functions should determine whether the restaurant is open.

Do not create another opening-hours algorithm inside the canteen package. That could cause the seed data and the API to disagree about opening times.

Each generated slot must carry the restaurant ID supplied to the conversion method.

The separation is useful:

  • The canteen package owns the restaurant's static business description.
  • The hours package owns the opening-hours indexing logic.
  • The seeding code can connect the description to the existing backend when needed.

A realistic menu should exercise more than basic item listing.

Some items have configurable options. A customer might need to select one size and can optionally choose additional toppings.

The application already has the Week 2 bitset-based validation logic.

A bitset can represent which options a customer selected. Validation can then enforce the rules associated with an option group.

For example, a required size selection must be present before the item can be added to the cart. Optional toppings should not be treated as required selections.

This matters during tester sessions. A menu with realistic options exercises the same validation rules that customers encounter in a real ordering flow.

Restaurant and rider accounts

Your testers should be able to exercise the restaurant and rider workflows.

The seed data should include:

  • A person with the restaurant role.
  • A person with the rider role.
  • Distinct email addresses for the operating accounts.

A customer role is also allowed.

Keep this identity information separate from authentication credentials.

The canteen Person structure contains descriptive information such as a name, email and role. It must not contain password, secret or token fields.

When you create actual accounts, use the existing signup and authentication flow. Obtain passwords from environment variables rather than embedding them in Go source code.

The complete ordering flow

Prepare enough data for a tester to complete the application workflow:

  1. Open the application.
  2. Browse the available restaurants.
  3. Open a restaurant menu.
  4. Configure an item and select its options.
  5. Add items to the cart.
  6. Place an order.
  7. Follow the order status.
  8. Verify the restaurant and rider workflows.

Opening hours are particularly important.

A restaurant should not accept an order merely because its menu contains available items. Its operating schedule is part of the business rules.

The next exercise, Seed the Real Canteen and Operating Accounts, connects the realistic data to the existing Week 2 index and provides the operating identities needed for the demonstration.

Feedback collection

Structured bug reports

When a tester reports a problem, record it before changing the code.

Use a GitHub issue so that the report can be reproduced, discussed and tracked through the next release.

A useful report contains:

  • Title: A short description of the observed failure.
  • Steps: The exact actions required to reproduce it.
  • Expected: What the application should have done.
  • Actual: What happened instead.
  • Device: The Android device model and Android version.
  • Reporter: The person who reported the problem.
  • Severity: The impact of the problem.

For example:

Title: Order submission fails after selecting item options

Steps:
1. Open the restaurant menu.
2. Select a pizza.
3. Choose a size and two toppings.
4. Add the item to the cart.
5. Submit the order.

Expected:
The order should be created successfully.

Actual:
The application displays an error after submission.

Reporter:
Tester 03

Severity:
sev1

Describe what the tester observed rather than assuming the cause.

For example, an order submission failure does not automatically mean Redis is responsible. The problem might originate in the mobile application, HTTP API, database transaction or order-processing worker.

Keep the initial report focused on reproducible behaviour.

Severity classification

Use three severity labels.

sev1: Blocks ordering

The issue prevents a customer from completing an important ordering operation or makes the core workflow unusable.

Examples:

  • The application crashes when submitting an order.
  • Order confirmation cannot complete.
  • The restaurant never receives a successfully submitted order.

sev2: Degrades functionality

The application remains usable, but an important feature behaves incorrectly or inconsistently.

Examples:

  • Restaurant listings display incorrect information.
  • Order tracking stops updating.
  • A menu option cannot be selected through the expected interaction.

sev3: Cosmetic

The problem affects presentation or convenience without breaking the main workflow.

Examples:

  • Incorrect spacing.
  • A misaligned button.
  • A confusing but non-blocking label.

Severity must represent the impact on the user. Do not classify every inconvenience as sev1.

Bug triage

Bug triage is the process of deciding which reported problems should be fixed first.

A list of reported problems is not automatically a list of equally important tasks. You need a consistent ranking rule.

For this course, the ranking uses three criteria in this exact order:

  1. Severity ascending: sev1 comes before sev2, which comes before sev3.
  2. Distinct reporters descending: Issues reported independently by more people come first within the same severity.
  3. Issue number ascending: When severity and reporter count are equal, the lower issue number comes first.

Distinct reporters matter because repeated reports from independent people provide evidence that a problem affects multiple users.

Count people, not mentions. The names Asha, asha and ASHA represent one reporter after trimming whitespace and ignoring capitalization.

Consider the ranking example used by the grading tests:

IssueSeverityReporters
#1sev33
#2sev11
#3sev21
#4sev22

The expected ranking is:

#2
#4
#3
#1

Issue #2 comes first because severity takes priority over reporter count. Between #4 and #3, the higher number of distinct reporters determines the order. Issue #1 comes last because it has the lowest severity.

When two issues have the same severity and reporter count, use their issue numbers as the deterministic tie-breaker.

Do not use implementation cost as an additional ranking criterion. The supplied tests define the ordering rules, and the issue number is the final comparison.

Deliberately excluded issues

Not every reported issue should necessarily enter the fix list.

Sometimes a team deliberately decides not to fix a particular issue in the current release. Use the wontfix label to represent that decision.

A deliberate exclusion needs an explanation.

The issue body must contain a line that begins with Reason: and contains non-empty text after it.

For example:

Reason: needs a redesign, out of scope for week 7

An issue marked wontfix without a written reason must be rejected by the triage process.

An issue without a severity label must also be rejected. Do not silently assign it a default priority.

This validation prevents incomplete reports from entering the release plan.

Selecting the fixes

The next exercise, Collect bugs for 4 days, fix the top 5, ship again, turns these rules into a small Go library.

Its planning process validates all reported issues before selecting candidates.

After validation:

  • Issues marked wontfix are excluded from the candidates.
  • Eligible issues are ranked using the specified ordering.
  • The first five eligible issues become the fix list.
  • Remaining eligible issues become deferred issues.
  • Deliberately excluded issues appear after the deferred issues.

If fewer than five eligible issues exist, fix all of them.

The generated report has two sections in a fixed order:

  • ## Fixed
  • ## Not fixed

Each fixed issue includes its number, title, severity and distinct reporter count.

Each issue that remains unfixed includes its number and title. Deliberately excluded issues also include their written reason.

This creates a record of both completed work and decisions that remain open.

The release feedback cycle

Shipping a preview APK is not the end of the release process.

You need to complete a cycle that starts with a working application and ends with a verified correction.

The process connects the three exercises in this module:

Android preview APK establishes the application configuration, produces an installable APK and puts the application in the hands of testers.

Seed the Real Canteen and Operating Accounts provides believable business data and operating identities so testers can exercise the complete ordering flow.

Collect bugs for 4 days, fix the top 5, ship again turns their reports into a prioritized plan, implements the selected fixes and distributes an updated APK.

When distributing the second build, preserve the application identity and ensure the Android version code has increased.

After installing the update, verify the affected flows again. A code change alone does not prove that the distributed application has been corrected.

Keep deferred issues in the report. They remain part of the product's known behaviour and should not disappear merely because another release has shipped.

Check your understanding

Question 1 of 4

You change EXPO_PUBLIC_API_URL in app/eas.json after distributing a preview APK. A tester opens the application that is already installed. What happens?

Pick an answer, then say how sure you are.

References

Everything above is explained on this page; these are where it comes from (Expo, EAS Build).

Finished Lesson 7.8?