Environments
Three environments, each with its own app id, name, icon and .env file. They install side by side.
| Environment | Android variant | iOS scheme / configuration | App id | .env |
|---|---|---|---|---|
| dev | devDebug, devRelease |
<App>-Dev / Debug-Dev, Release-Dev |
<id>.dev |
.env.dev |
| staging | stagingDebug, stagingRelease |
<App>-Staging / Debug-Staging, Release-Staging |
<id>.staging |
.env.staging |
| prod | prodDebug, prodRelease |
<App>-Prod / Debug-Prod, Release-Prod |
<id> |
.env.prod |
Running
Section titled “Running”pnpm android # devpnpm android:stagingpnpm ios # devpnpm ios:prodConfiguration values
Section titled “Configuration values”src/shared/config/env.ts is the only file that reads configuration. It validates every key with Zod, so a
missing or malformed value stops the app at launch with the key’s name. To add a key:
- Add it to
.env.exampleand each.env.<environment>. - Add it to
EnvSchemainsrc/shared/config/env.ts. - Use it through
env.MY_KEY.
Everything in .env.* ships inside the app and can be read by anyone who has it. Never put secrets there.
Adding an environment
Section titled “Adding an environment”- Android: add a flavor in
android/app/build.gradle(productFlavorsandenvConfigFiles) and its variants todebuggableVariants. - iOS: add it to
ENVIRONMENTSinscripts/ios/configure-environments.rb, runbundle exec ruby scripts/ios/configure-environments.rb, then add its configurations toprojectandENVFILESinios/Podfileand runpnpm pods. - Add
.env.<name>, an icon badge inscripts/icons.ts, and scripts inpackage.json. - Allow the new value in
EnvSchema.APP_ENV.