rn-flavors
Installation
SKILL.md
React Native Flavors, Schemes, and Environments
Instructions
Ship three environments: dev, staging, prod. Each has its own bundle ID / application ID, icon, display name, and API base URL. Never branch behavior on __DEV__ for environment selection.
1. Runtime Env Module
// src/app/env.ts
const envs = {
dev: { apiBaseUrl: 'https://dev.api.example.com', sentryDsn: '' },
staging: { apiBaseUrl: 'https://staging.api.example.com', sentryDsn: 'https://staging@...' },
prod: { apiBaseUrl: 'https://api.example.com', sentryDsn: 'https://prod@...' },
} as const;
type EnvName = keyof typeof envs;
const name = (process.env.EXPO_PUBLIC_APP_ENV ?? process.env.APP_ENV ?? 'dev') as EnvName;