Skip to content

Set up the Expo project

At the end of this page you have an Expo project linked to expo.dev, with three build profiles (dv, te, pd), that passes the pre-build checks. Everything on this page is shared by iOS and Android; values that belong to one platform are on that platform’s pages. Before you start you need: an Expo account and an app repo that already runs locally. Run every command in the app’s folder.

The ios/ and android/ folders are gitignored. EAS (Expo Application Services, Expo’s service for building and submitting apps) generates the native projects from app.json on every build, so config is changed in app.json only.

The Expo project owner installs the EAS CLI and logs in with their own Expo account.

Terminal window
npm install -g eas-cli
eas login
eas whoami # must show the account that will own the project

The Expo project owner runs eas init and picks the account that will own the project. EAS writes the project id into app.json. The real RiceSense output:

✔ Which account should own this project? › nakarin7527
✔ Would you like to create a project for @nakarin7527/ricesense? … yes
✔ Created @nakarin7527/ricesense
✔ Project successfully linked (modified app.json)
✔ Set the project icon from icon in your app config

Which account should own this project?

The Expo account that all builds and submissions live under

  • The agreed accountOur choiceEvery build is in one place and the team can see the status
  • Another accountThe project has to be moved later, and the credentials EAS stores end up in the wrong place

We enterednakarin7527

When it finishes, the developer opens the diff of app.json. If there are values you did not set yourself, such as a list of permissions the app does not use, remove them before committing.

One app builds in three variants. Each talks to its own API and has a different bundle id, so they can be installed side by side on one device, and a test build can never be sent to the store by mistake.

dv te pd
Used for Developer’s own testing Team or client testing before release Real users and the stores
EAS build profile dv te pd
APP_VARIANT dv te Not set
API api-dv.ricesense.com api-te.ricesense.com api.ricesense.com
Bundle id / package name th.co.ricesense.app.dv th.co.ricesense.app.te th.co.ricesense.app
Name on the device RiceSense DV RiceSense TE RiceSense
Output file Ad-hoc APK / IPA Ad-hoc APK / IPA AAB / IPA for the store

An APK is an Android file that installs directly. An AAB (Android App Bundle) is the file Google Play accepts. An IPA is an iOS app file, and ad-hoc means an IPA that installs only on registered iPhones.

eas build --profile

Picks which environment this build belongs to

  • dvPoints at the dv API, installs directly on registered devices, used during development
  • tePoints at the te API, for the team or client to test before release
  • pdOur choicePoints at the production API and produces store files. The only one that can go to TestFlight and Google Play

WhyThe build sent for review must be pd only. dv and te are for testing before that

The developer sets these values in app.json. Values that belong only to iOS or Android are set on Apple account and app identity and Build and Internal testing.

Value RiceSense Why
name RiceSense The pd app’s name on the device
version 1.0.0 The version users see. The developer changes it every release
icon ./assets/icon.png 1024×1024 PNG, solid background, no rounded corners of your own
ios.bundleIdentifier th.co.ricesense.app The app’s identity on the App Store. Cannot be changed once set
android.package th.co.ricesense.app The app’s identity on Google Play. Cannot be changed once set

ios.bundleIdentifier / android.package

The unique name the stores use to identify the app, written as a reversed domain

  • Same value on both platformsOur choiceEasy to remember and check, and the .dv / .te suffixes work the same way
  • Different valuesPossible, but there are two names to remember and the guard in app.config.js needs separate cases

We enteredth.co.ricesense.app

WhyUses the company domain reversed. It cannot be changed after the app is created in the stores

The developer creates eas.json with three build profiles. The submit settings for sending the app to the stores are added later on each platform’s pages.

eas.json
{
"cli": { "version": ">= 24.12.0", "appVersionSource": "remote" },
"build": {
"base": { "node": "24.21.0", "pnpm": "11.19.0" },
"dv": {
"extends": "base",
"distribution": "internal",
"autoIncrement": true,
"env": { "APP_VARIANT": "dv", "EXPO_PUBLIC_API_URL": "https://api-dv.ricesense.com/api/v1" },
"android": { "buildType": "apk" }
},
"te": {
"extends": "base",
"distribution": "internal",
"autoIncrement": true,
"env": { "APP_VARIANT": "te", "EXPO_PUBLIC_API_URL": "https://api-te.ricesense.com/api/v1" },
"android": { "buildType": "apk" }
},
"pd": {
"extends": "base",
"autoIncrement": true,
"env": { "EXPO_PUBLIC_API_URL": "https://api.ricesense.com/api/v1" }
}
}
}

appVersionSource

Who counts the build number (iOS buildNumber and Android versionCode go up with every build; the stores reject a repeated number)

  • remote + autoIncrementOur choiceEAS stores the number and increments it on every build, with no clashes even when building from several machines
  • localYou edit the number in app.json yourself every time. If you forget, the store rejects the file

distribution

How the output file is distributed

  • internalProduces an APK or ad-hoc IPA that installs directly from a link. Used for dv and te
  • store (the default, no need to write it)Our choiceProduces an AAB and an IPA signed for the store, which cannot be installed directly. Used for pd

The developer creates app.config.js. This file does two things: it changes the name and bundle id for dv / te, and it makes an EAS build fail immediately if the API URL does not match the profile. This stops a build pointing at the wrong API from reaching testers.

app.config.js
// Each variant's identity layered on app.json; pd does not set APP_VARIANT and keeps the store identity
const VARIANTS = {
dv: { name: 'RiceSense DV', idSuffix: '.dv' },
te: { name: 'RiceSense TE', idSuffix: '.te' },
};
// The API each variant must use on EAS; if it does not match, the build fails immediately
const API_URLS = {
pd: 'https://api.ricesense.com/api/v1',
te: 'https://api-te.ricesense.com/api/v1',
dv: 'https://api-dv.ricesense.com/api/v1',
};
function checkApiUrl(variant) {
if (process.env.EAS_BUILD !== 'true') return; // local runs may use the value from .env
const expected = API_URLS[variant];
const actual = process.env.EXPO_PUBLIC_API_URL;
if (actual !== expected) {
throw new Error(`EXPO_PUBLIC_API_URL for ${variant} must be ${expected}, got "${actual ?? ''}"`);
}
}
module.exports = ({ config }) => {
const name = process.env.APP_VARIANT;
checkApiUrl(name || 'pd');
if (!name || name === 'pd') return config;
const variant = VARIANTS[name];
if (!variant) throw new Error(`Unknown APP_VARIANT "${name}"`);
return {
...config,
name: variant.name,
ios: { ...config.ios, bundleIdentifier: config.ios.bundleIdentifier + variant.idSuffix },
android: { ...config.android, package: config.android.package + variant.idSuffix },
};
};

Before putting a URL into eas.json and app.config.js, the developer checks with curl that the URL is a real API that answers with JSON, not a web page.

Terminal window
curl -sS -o /dev/null -w '%{http_code} %{content_type}\n' https://api.ricesense.com/api/v1/
# 404 application/json ← a JSON answer means it is right (404 because there is no endpoint at the root)

If you get text/html, the URL belongs to a web page, such as the admin site, not the API. Find the right URL first.

The developer adds credentials/ to .gitignore. Secret files for both stores (the Apple API key, the keystore and the Google JSON) are kept in this folder only, with permissions set so only the file owner can read them.

Terminal window
echo "credentials/" >> .gitignore
mkdir -p credentials

Every time you put a new file in this folder, run chmod 600 credentials/*. Files in this folder must never be sent by chat or email.

The developer runs these three commands before every build. All three must pass.

Terminal window
npx expo-doctor
pnpm run typecheck
pnpm test
  • eas whoami shows the account that owns the project, and app.json has a project id
  • app.json has version, name, icon, ios.bundleIdentifier and android.package matching the table
  • eas.json has the dv, te, pd profiles and appVersionSource is remote
  • The URLs of all three environments answer with application/json
  • credentials/ is in .gitignore
  • expo-doctor, typecheck and tests pass

Next: Backend and demo account