Calculates on this device. File exports run online.
React Native Environment File Checker
Paste or open the .env file of your app, and if you like its .env.example and some code. Choose how the app reads the file and press Check the .env file. The page lists every problem with its line. It never shows a value: only whether a key is filled.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to check a .env file
- Open the .env file in the first box. It is read in this browser.
- Add .env.example to find keys that are missing on one side, and code to find keys that the code reads but the file does not set.
- Choose Expo, react-native-config, react-native-dotenv or dotenv: each has its own rules.
- Press Check the .env file. To check the code of a whole project, use the box below: it receives only the key names.
What is checked in the file
- Each line must be KEY=value, with an optional
exportin front;#starts a comment line. A key has letters, digits and _ (a key with - or . or a digit first cannot be read as process.env.KEY). - Quotes: a value in
',"or a backtick may run over several lines; a quote that is never closed takes the rest of the file into the value. - Comments: dotenv stops a value at
#, sokey#2is read askey. Put such a value in quotes. - Empty values and keys that are set twice (dotenv keeps the last one).
- react-native-config wants plain KEY=value lines: its README warns that a stray space can break reading, so spaces,
exportand values over several lines are marked. - Expo: values of variables named EXPO_PUBLIC_… are visible in plain text in the compiled app, so names with SECRET, PRIVATE or PASSWORD, and private keys, are marked.
What is checked in the code
- Expo puts only variables named EXPO_PUBLIC_… into the code of the app, and replaces only
process.env.EXPO_PUBLIC_KEYwritten with a dot:process.env['EXPO_PUBLIC_KEY']andconst { EXPO_PUBLIC_KEY } = process.envare not replaced (Expo docs, “Environment variables”). - react-native-config:
Config.KEYafterimport Config from 'react-native-config'(also under another name). - react-native-dotenv:
import { KEY } from '@env'(or the module name you set in its moduleName option), andprocess.env.KEY. - Comments, strings and regular expressions are skipped, so text such as
'process.env.X'in a string is not counted. A name worked out while the app runs, such asprocess.env[name], cannot be checked and is listed as a note.
Make a .env.example
Choose Make a .env.example to get the same keys and comments with every value left out. Read the comments before you share the file: a comment may hold a value.
Limits you should know
- The file is read by the rules of dotenv. Each library has its own reader, and react-native-config reads the file in its own native build steps, so a line that passes here can still fail there.
- Variables expanded inside a value (such as ${OTHER}) are not worked out.
- The code is read word by word, not run or fully parsed; very unusual code can be missed.
- Keys that the app gets from somewhere else (a build server, EAS, the shell) are not known here and may show as not set.