> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobile-starter.amisi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# EAS Setup

> Configure Expo Application Services for building and deploying your app

## Prerequisites

* Expo account ([sign up](https://expo.dev/signup))
* EAS CLI installed globally
* Completed [App Identity](/configuration/app-identity) configuration

## Install EAS CLI

Install the EAS CLI globally:

```bash theme={null}
npm install -g eas-cli
```

Verify installation:

```bash theme={null}
eas --version
```

## Login to EAS

Authenticate with your Expo account:

```bash theme={null}
eas login
```

Enter your Expo credentials when prompted.

## Initialize EAS Project

Navigate to the mobile app directory and initialize EAS:

```bash theme={null}
cd apps/mobile
eas init
```

You'll be prompted to:

1. Create a new EAS project or link to an existing one
2. Choose a project name (or use the default from `app.json`)

The command will:

* Create an EAS project in your Expo account
* Add the project ID to `app.json` under `extra.eas.projectId`

## Understanding Build Profiles

The starter includes three pre-configured build profiles in `apps/mobile/eas.json`:

### Development Profile

For internal testing with development builds:

```json theme={null}
{
  "development": {
    "developmentClient": true,
    "distribution": "internal",
    "env": {
      "APP_ENV": "development"
    }
  }
}
```

* Includes development client for debugging
* Internal distribution (not for app stores)
* Uses development environment variables

### Preview Profile

For testing builds before production:

```json theme={null}
{
  "preview": {
    "distribution": "internal",
    "ios": {
      "simulator": true
    },
    "android": {
      "buildType": "apk"
    },
    "env": {
      "APP_ENV": "preview"
    }
  }
}
```

* Internal distribution
* iOS simulator builds for testing
* Android APK for easy distribution
* Uses preview environment variables

### Production Profile

For app store releases:

```json theme={null}
{
  "production": {
    "android": {
      "buildType": "app-bundle"
    },
    "env": {
      "APP_ENV": "production"
    }
  }
}
```

* Android App Bundle (AAB) for Play Store
* Production environment variables
* Optimized for store submission

## Building with EAS

The starter includes Nx-integrated build commands for convenience.

### Development Build

Build a development client:

```bash theme={null}
# From repository root
bun run build:development

# Or directly with EAS
cd apps/mobile
eas build --profile development --platform all
```

### Preview Build

Build a preview version:

```bash theme={null}
bun run build:preview

# Or with EAS
cd apps/mobile
eas build --profile preview --platform all
```

### Production Build

Build for app stores:

```bash theme={null}
bun run build:production

# Or with EAS
cd apps/mobile
eas build --profile production --platform all
```

### Platform-Specific Builds

Build for a specific platform:

```bash theme={null}
# iOS only
eas build --profile production --platform ios

# Android only
eas build --profile production --platform android
```

## Submitting to App Stores

After building with the production profile, submit to stores:

```bash theme={null}
bun run submit:production

# Or with EAS
cd apps/mobile
eas submit --platform all
```

Follow the prompts to:

* Select the build to submit
* Provide App Store Connect / Google Play credentials
* Configure submission settings

## Environment Variables in EAS

EAS supports environment variables in builds through multiple methods:

### 1. Build Profile Environment Variables

Define in `eas.json`:

```json theme={null}
{
  "production": {
    "env": {
      "APP_ENV": "production",
      "API_URL": "https://api.example.com"
    }
  }
}
```

### 2. EAS Secrets

For sensitive values, use EAS Secrets:

```bash theme={null}
# Create a secret
eas secret:create --scope project --name FIREBASE_API_KEY --value "your-key"

# List secrets
eas secret:list

# Delete a secret
eas secret:delete --name FIREBASE_API_KEY
```

Secrets are automatically available as environment variables during builds.

### 3. .env Files

Local `.env` files are **not** included in EAS builds by default. Use EAS Secrets instead.

## Build Configuration

### iOS Specific

For iOS builds, you may need to configure:

**App Store Connect API Key** (recommended):

```bash theme={null}
eas credentials
```

**Or manual signing**:

* Provisioning profiles
* Distribution certificates

### Android Specific

For Android builds, configure:

**Keystore** (for signing):

```bash theme={null}
eas credentials
```

EAS can generate and manage keystores automatically.

## Monitoring Builds

### View Build Status

Check build progress:

```bash theme={null}
eas build:list
```

Or visit the [EAS dashboard](https://expo.dev) to monitor builds in real-time.

### Build Logs

View detailed logs:

```bash theme={null}
eas build:view [BUILD_ID]
```

## Common Build Commands

```bash theme={null}
# List all builds
eas build:list

# View specific build
eas build:view [BUILD_ID]

# Cancel a build
eas build:cancel [BUILD_ID]

# Configure credentials
eas credentials

# View project info
eas project:info

# Configure webhooks
eas webhook:create
```

## EAS Update (OTA Updates)

Configure over-the-air updates for quick fixes:

### 1. Configure Update Channel

In `eas.json`, add update channels:

```json theme={null}
{
  "production": {
    "channel": "production"
  },
  "preview": {
    "channel": "preview"
  }
}
```

### 2. Publish an Update

```bash theme={null}
eas update --branch production --message "Bug fixes"
```

### 3. View Updates

```bash theme={null}
eas update:list
```

## Troubleshooting

### Build Fails with Missing Dependencies

Ensure `eas-build-post-install` script runs correctly. Check `apps/mobile/package.json`:

```json theme={null}
{
  "scripts": {
    "eas-build-post-install": "cd ../../ && node tools/scripts/eas-build-post-install.mjs . apps/mobile"
  }
}
```

### iOS Signing Issues

Run credentials configuration:

```bash theme={null}
eas credentials
```

### Android Build Fails

Check that your package name is unique and valid:

* No uppercase letters
* Reverse domain notation
* Matches `app.json` configuration

### Environment Variables Not Available

Ensure variables are:

1. Defined in `eas.json` env block, OR
2. Created as EAS Secrets, OR
3. Have `EXPO_PUBLIC_` prefix for client-side access

## Best Practices

1. **Use EAS Secrets** for sensitive values (API keys, tokens)
2. **Test preview builds** before production releases
3. **Version your builds** consistently
4. **Monitor build logs** for warnings
5. **Use channels** for staged rollouts with EAS Update
6. **Automate submissions** with CI/CD pipelines

## Official Documentation

* [EAS Build](https://docs.expo.dev/build/introduction/)
* [EAS Submit](https://docs.expo.dev/submit/introduction/)
* [EAS Update](https://docs.expo.dev/eas-update/introduction/)
* [Environment Variables](https://docs.expo.dev/build-reference/variables/)
* [Credentials](https://docs.expo.dev/app-signing/app-credentials/)

## Next Steps

* [Configure Firebase](/configuration/firebase-setup)
* [Set Environment Variables](/configuration/environment-variables)
* [Configure Adapters](/configuration/adapters)
