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.
1. Install and log in to the EAS CLI
Section titled “1. Install and log in to the EAS CLI”The Expo project owner installs the EAS CLI and logs in with their own Expo account.
npm install -g eas-clieas logineas whoami # must show the account that will own the project2. Link the project to expo.dev
Section titled “2. Link the project to expo.dev”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 configWhich account should own this project?
The Expo account that all builds and submissions live under
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.
3. Split three environments
Section titled “3. Split three environments”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
WhyThe build sent for review must be pd only. dv and te are for testing before that
4. Set the shared values in app.json
Section titled “4. Set the shared values in app.json”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
We enteredth.co.ricesense.app
WhyUses the company domain reversed. It cannot be changed after the app is created in the stores
5. Create eas.json
Section titled “5. Create eas.json”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.
{ "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)
distribution
How the output file is distributed
6. Add the API URL guard in app.config.js
Section titled “6. Add the API URL guard in app.config.js”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.
// Each variant's identity layered on app.json; pd does not set APP_VARIANT and keeps the store identityconst 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 immediatelyconst 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.
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.
7. Keep secret files out of Git
Section titled “7. Keep secret files out of Git”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.
echo "credentials/" >> .gitignoremkdir -p credentialsEvery 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.
8. Check the project before building
Section titled “8. Check the project before building”The developer runs these three commands before every build. All three must pass.
npx expo-doctorpnpm run typecheckpnpm testCheck before moving on
Section titled “Check before moving on”eas whoamishows the account that owns the project, andapp.jsonhas a project idapp.jsonhasversion,name,icon,ios.bundleIdentifierandandroid.packagematching the tableeas.jsonhas thedv,te,pdprofiles andappVersionSourceisremote- The URLs of all three environments answer with
application/json credentials/is in.gitignoreexpo-doctor, typecheck and tests pass
Next: Backend and demo account