{"id":15657627,"url":"https://github.com/tuchk4/react-app-env","last_synced_at":"2025-09-21T17:36:44.993Z","repository":{"id":44176676,"uuid":"77153851","full_name":"tuchk4/react-app-env","owner":"tuchk4","description":"Run create-react-app application with env variables","archived":false,"fork":false,"pushed_at":"2022-12-09T08:16:57.000Z","size":244,"stargazers_count":23,"open_issues_count":13,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T06:14:19.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuchk4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-22T15:09:12.000Z","updated_at":"2021-08-19T15:09:22.000Z","dependencies_parsed_at":"2023-01-25T19:31:56.226Z","dependency_job_id":null,"html_url":"https://github.com/tuchk4/react-app-env","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Freact-app-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Freact-app-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Freact-app-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Freact-app-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuchk4","download_url":"https://codeload.github.com/tuchk4/react-app-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016641,"owners_count":21198833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T13:08:50.797Z","updated_at":"2025-09-21T17:36:39.917Z","avatar_url":"https://github.com/tuchk4.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deprecated\n\nCRA supports multiple `.env`  configs out of the box [Feature/different env config files #1343](https://github.com/facebookincubator/create-react-app/pull/1344)\n\nDocs - [Adding Development Environment Variables](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-development-environment-variables-in-env)\n\n\n----\n\n\n\nRun [create-react-app](https://github.com/facebookincubator/create-react-app) application with env variables.\n\n## Create react app PR\n\nThere is Issue and PR to create-react-app repository to support different env configs.\nhttps://github.com/facebookincubator/create-react-app/issues/1343\n\n\n## Better Use [dotenv](https://www.npmjs.com/package/dotenv)\n\n*create-react-app* read variables from `.env` config out of the box. \nBut if you need to read from custom config - update npm scripts:\n\n```\n\"scripts\": {\n  \"start\": \"node -r dotenv/config ./node_modules/.bin/react-scripts start dotenv_config_path=development.env\",\n  \"build\": \"node -r dotenv/config ./node_modules/.bin/react-scripts build dotenv_config_path=production.env\"\n}\n```\n\n## [React app env](https://github.com/tuchk4/react-app-env)\n\nCozy and cross OS *create-react-app* application runner with environment variables.\n\nDefault environment files:\n\n* *start* and *test* script - *development.env*\n* *build* script - *production.env*\n\n---\n\nEnvironment file example *./development.env*\n\n```\nGOOGLE_CLIENT_ID = XXX_YYY_ZZZ\nAPI_PROTOCOL = http:\nAPI_HOST = localhost:9876\nAPI_PREFIX = api\nAPI_SECURITY_TOKEN = access_token\n\nNODE_PATH = src/scripts\nPORT = 9001\n```\n*react-app-env* will automatically add `REACT_APP` prefix to each env variable except:\n\n* PORT - dev server port\n* NODE_PATH - directory name to be resolved to the current directory as well as its ancestors, and searched for modules. It is [resolve.modulesDirectories](https://webpack.github.io/docs/configuration.html#resolve-modulesdirectories) for webpack. More details at node official doc [\"Loading from the global folders\"](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders)\n\nWith this environment file defined above:\n\n```\nreact-app-env start\n```\n\nequals to\n\n```\ncross-env REACT_APP_GOOGLE_CLIENT_ID=XXX_YYY_ZZZ REAC_APP_API_PROTOCOL=http: REACT_APP_API_HOST=localhost:9876 REACT_APP_API_PREFIX=api REACT_APP_API_SECURITY_TOKEN=acess_token NODE_PATH=src/scripts PORT=9001 react-scripts start\n```\n\nUse environment variables:\n\n```js\nconst googleClientId = process.env.REACT_APP_GOOGLE_CLIENT_ID;\nconst apiHost = process.env.REACT_APP_API_HOST;\n```\n\n### Custom env files\n\n* use *--env-file* flag\n\n```\nreact-app-env --env-file=configs/local.env start\n```\n\n\n### Install\n\n```\nnpm i --save-dev react-app-env\n```\n\n### npm scripts\n\n```\n\"scripts\": {\n  \"start\": \"react-app-env start\",\n  \"build\": \"react-app-env build\",\n  \"test\": \"react-app-env test\",\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuchk4%2Freact-app-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuchk4%2Freact-app-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuchk4%2Freact-app-env/lists"}