React Native theorytheory 0/50 · 0%
Tooling · easy

19. Environment and config

Managing API keys and per-environment settings.

Apps typically need different RPC URLs, chain ids or API keys for development vs. production, managed with a library like `react-native-dotenv` or Expo's `app.config.ts` `extra` field.

// app.config.ts (Expo)
export default {
  expo: {
    name: "WalletApp",
    extra: {
      rpcUrl: process.env.RPC_URL ?? "https://mainnet.base.org",
    },
  },
};

Secrets embedded in a mobile bundle are still extractable by a determined attacker, so never ship a server-only private key inside the app — proxy sensitive calls through your own backend instead.

Check your understanding

  1. 1. Why might dev and prod use different RPC URLs?

  2. 2. Are secrets bundled into a mobile app safe from extraction?

  3. 3. What's the safer pattern for sensitive keys?