Encrypt secrets in Expo

Learn how to encrypt your first .env file using Expo and the Dotenvx Node.js SDK.

1. Install

Get the Dotenvx Node.js SDK.

$ npm install @dotenvx/dotenvx
# or
# bun add @dotenvx/dotenvx
# pnpm add @dotenvx/dotenvx

2. Encrypt

Encrypt your .env file.

$ npx dotenvx encrypt
◈ encrypted (.env)

3. Inject

Preface Expo scripts with dotenvx run --.

package.json

{
  "scripts": {
    "start": "dotenvx run -- expo start",
    "reset-project": "node ./scripts/reset-project.js",
    "android": "dotenvx run -- expo start --android",
    "ios": "dotenvx run -- expo start --ios",
    "web": "dotenvx run -- expo start --web",
    "lint": "expo lint"
  }
}