If you are not sure if the website you would like to visit is secure, you can verify it here. Enter the website address of the page and see parts of its content and the thumbnail images on this site. None (if any) dangerous scripts on the referenced page will be executed. Additionally, if the selected site contains subpages, you can verify it (review) in batches containing 5 pages.
favicon.ico: create-react-app.dev/docs/adding-custom-environment-variables - Adding Custom Environment Vari.

site address: create-react-app.dev/docs/adding-custom-environment-variables redirected to: create-react-app.dev/docs/adding-custom-environment-variables

site title: Adding Custom Environment Variables Create React App

Our opinion (on Tuesday 17 November 2026 5:07:27 UTC):

GREEN status (no comments) - no comments
After content analysis of this website we propose the following hashtags:


page from cache: 1 minute ago
Meta tags:
description=Note: this feature is available with react-scripts@0.2.3 and higher.;

Headings (most frequently used words):

environment, variables, in, adding, env, windows, custom, referencing, the, html, temporary, your, shell, development, cmd, exe, powershell, linux, macos, bash, what, other, files, can, be, used, expanding,

Text of the page (most frequently used words):
the (51), env (41), #environment (37), variables (34), you (27), this (17), for (17), and (15), will (15), development (14), your (14), local (14), with (13), #adding (12), app (12), note (12), react (11), can (11), npm (11), node_env (11), copy (10), react_app_not_secret_code (10), variable (9), production (9), build (9), files (8), are (8), test (8), start (7), create (7), process (7), example (6), need (6), them (6), run (6), have (6), any (6), that (6), abcdef (6), when (6), form (6), other (5), html (5), file (5), also (5), feature (5), available (5), higher (5), scripts (5), these (5), defined (5), server (5), react_app_ (5), from (5), windows (4), shell (4), machine (4), using (4), set (4), custom (4), running (4), runtime (4), value (4), div (4), small (4), read (4), github (3), temporary (3), domain (3), expand (3), npm_package_version (3), documentation (3), more (3), except (3), into (3), restart (3), changing (3), must (3), avoid (3), accidentally (3), private (3), called (3), project (3), bundle (3), consume (3), input (3), always (3), equal (3), get (2), started (2), docs (2), expanding (2), what (2), used (2), linux (2), macos (2), bash (2), powershell (2), cmd (2), exe (2), referencing (2), making (2), progressive (2), web (2), next (2), router (2), page (2), current (2), react_app_version (2), dotenv (2), defining (2), see (2), not (2), overrides (2), specific (2), settings (2), default (2), control (2), beginning (2), ignored (2), require (2), exposing (2), key (2), could (2), same (2), name (2), time (2), few (2), built (2), above (2), title (2), access (2), starting (2), having (2), useful (2), conditionally (2), ways (2), described (2), hidden (2), type (2), mode (2), application (2), load (2), during (2), here (2), embedded (2), declared (2), copyright, 2025, facebook, inc, social, contributor, covenant, twitter, discussions, stack, overflow, community, learn, previous, last, updated, joe, haddad, 2020, edit, react_app_bar, bar, react_app_foo, foo, www, com, works, already, use, hosting, platform, most, likely, well, consult, their, how, heroku, travis, please, refer, details, act, defaults, does, explicitly, missing, left, priority, than, right, loaded, all, environments, checked, source, exclusion, should, after, define, permanent, root, quotes, around, assignment, required, trailing, whitespace, vary, between, oses, important, know, manner, life, session, injected, inject, follow, approach, instead, apart, names, work, public_url, caveats, section, apply, react_app_website_name, public, index, compile, minification, step, strip, out, condition, resulting, smaller, disable, analytics, performing, actions, looking, order, done, two, either, both, sections, browser, inspect, its, bold, text, show, provided, replaced, remember, automatically, defaultvalue, return, render, first, let, say, wanted, inside, displaying, information, based, where, deployed, consuming, sensitive, data, lives, outside, version, there, make, prevents, developers, deploying, slow, cannot, override, manually, named, exposed, since, produces, static, css, possibly, would, memory, replace, placeholders, alternatively, rebuild, anytime, change, meaning, anyone, view, inspecting, warning, store, secrets, such, api, keys, they, were, locally, support, advanced, usage, deployment, back, end, integration, testing, creating, measuring, performance, relay, typescript, flow, bootstrap, global, importing, component, installing, dependency, building, styles, assets, getting, welcome, search, help, deprecated, skip, main, content,


Text of the page (random words):
adding custom environment variables create react app skip to main content create react app is deprecated read more here create react app docs help github search k welcome getting started development styles and assets building your app installing a dependency importing a component using global variables adding bootstrap adding flow adding typescript adding relay adding a router environment variables making a progressive web app measuring performance creating a production build testing back end integration deployment advanced usage support on this page adding custom environment variables note this feature is available with react scripts 0 2 3 and higher your project can consume variables declared in your environment as if they were declared locally in your js files by default you will have node_env defined for you and any other environment variables starting with react_app_ warning do not store any secrets such as private api keys in your react app environment variables are embedded into the build meaning anyone can view them by inspecting your app s files the environment variables are embedded during the build time since create react app produces a static html css js bundle it can t possibly read them at runtime to read them at runtime you would need to load html into memory on the server and replace placeholders in runtime as described here alternatively you can rebuild the app on the server anytime you change them note you must create custom environment variables beginning with react_app_ any other variables except node_env will be ignored to avoid accidentally exposing a private key on the machine that could have the same name changing any environment variables will require you to restart the development server if it is running these environment variables will be defined for you on process env for example having an environment variable named react_app_not_secret_code will be exposed in your js as process env react_app_not_secret_code there is also a built in environment variable called node_env you can read it from process env node_env when you run npm start it is always equal to development when you run npm test it is always equal to test and when you run npm run build to make a production bundle it is always equal to production you cannot override node_env manually this prevents developers from accidentally deploying a slow development build to production these environment variables can be useful for displaying information conditionally based on where the project is deployed or consuming sensitive data that lives outside of version control first you need to have environment variables defined for example let s say you wanted to consume an environment variable inside a form render return div small you are running this application in b process env node_env b mode small form input type hidden defaultvalue process env react_app_not_secret_code form div copy during the build process env react_app_not_secret_code will be replaced with the current value of the react_app_not_secret_code environment variable remember that the node_env variable will be set for you automatically when you load the app in the browser and inspect the input you will see its value set to abcdef and the bold text will show the environment provided when using npm start div small you are running this application in b development b mode small form input type hidden value abcdef form div copy the above form is looking for a variable called react_app_not_secret_code from the environment in order to consume this value we need to have it defined in the environment this can be done using two ways either in your shell or in a env file both of these ways are described in the next few sections having access to the node_env is also useful for performing actions conditionally if process env node_env production analytics disable copy when you compile the app with npm run build the minification step will strip out this condition and the resulting bundle will be smaller referencing environment variables in the html note this feature is available with react scripts 0 9 0 and higher you can also access the environment variables starting with react_app_ in the public index html for example title react_app_website_name title copy note that the caveats from the above section apply apart from a few built in variables node_env and public_url variable names must start with react_app_ to work the environment variables are injected at build time if you need to inject them at runtime follow this approach instead adding temporary environment variables in your shell defining environment variables can vary between oses it s also important to know that this manner is temporary for the life of the shell session windows cmd exe set react_app_not_secret_code abcdef npm start copy note quotes around the variable assignment are required to avoid a trailing whitespace windows powershell env react_app_not_secret_code abcdef and npm start copy linux macos bash react_app_not_secret_code abcdef npm start copy adding development environment variables in env note this feature is available with react scripts 0 5 0 and higher to define permanent environment variables create a file called env in the root of your project react_app_not_secret_code abcdef copy note you must create custom environment variables beginning with react_app_ any other variables except node_env will be ignored to avoid accidentally exposing a private key on the machine that could have the same name changing any environment variables will require you to restart the development server if it is running note you need to restart the development server after changing env files env files should be checked into source control with the exclusion of env local what other env files can be used note this feature is available with react scripts 1 0 0 and higher env default env local local overrides this file is loaded for all environments except test env development env test env production environment specific settings env development local env test local env production local local overrides of environment specific settings files on the left have more priority than files on the right npm start env development local env local env development env npm run build env production local env local env production env npm test env test local env test env note env local is missing these variables will act as the defaults if the machine does not explicitly set them please refer to the dotenv documentation for more details note if you are defining environment variables for development your ci and or hosting platform will most likely need these defined as well consult their documentation how to do this for example see the documentation for travis ci or heroku expanding environment variables in env note this feature is available with react scripts 1 1 0 and higher expand variables already on your machine for use in your env file using dotenv expand for example to get the environment variable npm_package_version react_app_version npm_package_version also works react_app_version npm_package_version copy or expand variables local to the current env file domain www example com react_app_foo domain foo react_app_bar domain bar copy edit this page last updated on 5 29 2020 by joe haddad previous adding a router next making a progressive web app referencing environment variables in the html adding temporary environment variables in your shell windows cmd exe windows powershell linux macos bash adding development environment variables in env what other env files can be used expanding environment variables in env docs get started learn react community stack overflow github discussions twitter contributor covenant social github copyright 2025 facebook inc
Images from subpage: "create-react-app.dev/docs/running-tests" Verify
Images from subpage: "create-react-app.dev/docs/proxying-api-requests-in-developme... " Verify
Images from subpage: "create-react-app.dev/docs/deployment" Verify
Images from subpage: "create-react-app.dev/docs/custom-templates" Verify
Images from subpage: "create-react-app.dev/docs/troubleshooting" Verify

Verified site has: 20 subpage(s). Do you want to verify them? Verify pages:

1-5 6-10 11-15 16-20


Top 50 hastags from of all verified websites.

Supplementary Information (add-on for SEO geeks)*- See more on header.verify-www.com

Header

HTTP/2 301
server GitHub.com
content-type text/html
location htt????/create-react-app.dev/docs/adding-custom-environment-variables/
access-control-allow-origin *
expires Tue, 17 Nov 2026 05:16:17 GMT
cache-control max-age=600
x-proxy-cache MISS
x-github-request-id C2E4:3A381:1A1688E:1A44D81:6AFBE0C9
x-github-edge-region fra
accept-ranges bytes
age 0
date Tue, 17 Nov 2026 05:06:17 GMT
via 1.1 varnish
x-served-by cache-rtm-ehrd2290048-RTM
x-cache MISS
x-cache-hits 0
x-timer S1794891978.666600,VS0,VE124
vary Accept-Encoding
x-fastly-request-id b19a75110e6410c236a358905819f90ac9f479ce
content-length 162
HTTP/2 200
server GitHub.com
content-type text/html; charset=utf-8
last-modified Fri, 14 Feb 2025 20:27:58 GMT
access-control-allow-origin *
etag W/ 67afa74e-b571
expires Tue, 17 Nov 2026 05:16:17 GMT
cache-control max-age=600
content-encoding gzip
x-proxy-cache MISS
x-github-request-id 2F02:3A381:1A16990:1A44E89:6AFBE0C9
x-github-edge-region fra
accept-ranges bytes
age 0
date Tue, 17 Nov 2026 05:06:17 GMT
via 1.1 varnish
x-served-by cache-rtm-ehrd2290048-RTM
x-cache MISS
x-cache-hits 0
x-timer S1794891978.798612,VS0,VE120
vary Accept-Encoding
x-fastly-request-id 315a43fecec11074db9c59ab2d9dfd7272b12ac9
content-length 8317

Meta Tags

title="Adding Custom Environment Variables | Create React App"
charset="UTF-8"
name="viewport" content="width=device-width,initial-scale=1"
name="generator" content="Docusaurus v2.0.0-beta.14"
data-react-helmet="true" name="twitter:card" content="summary_large_image"
data-react-helmet="true" property="og:image" content="htt????/create-react-app.dev/img/logo-og.png"
data-react-helmet="true" name="twitter:image" content="htt????/create-react-app.dev/img/logo-og.png"
data-react-helmet="true" property="og:url" content="htt????/create-react-app.dev/docs/adding-custom-environment-variables"
data-react-helmet="true" name="docsearch:language" content="en"
data-react-helmet="true" name="docsearch:version" content="current"
data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-current"
data-react-helmet="true" property="og:title" content="Adding Custom Environment Variables | Create React App"
data-react-helmet="true" name="description" content="Note: this feature is available with react-scripts@0.2.3 and higher."
data-react-helmet="true" property="og:description" content="Note: this feature is available with react-scripts@0.2.3 and higher."

Load Info

page size46449
load time (s)0.330242
redirect count1
speed download25203
server IP 185.199.109.153
* all occurrences of the string "http://" have been changed to "htt???/"