diff --git a/docs/pages/repo/docs/handbook/environment-variables.mdx b/docs/pages/repo/docs/handbook/environment-variables.mdx index f49ab06196951..6bb3d539f7f37 100644 --- a/docs/pages/repo/docs/handbook/environment-variables.mdx +++ b/docs/pages/repo/docs/handbook/environment-variables.mdx @@ -31,3 +31,24 @@ We're actively looking forward to improving the developer experience and ergonom ## With global `turbo` If you're using `turbo` globally, you'll also need to install `dotenv-cli` globally so you can put `dotenv --` in front of the `turbo` command in your terminal. + +## With workspace scripts + +You may prefer to make your workspaces responsible for loading environment variables. This approach is more flexible, if you don't mind the extra configuration overhead in your `package.json` scripts. + +To use this strategy: + +1. Place all of your variables into the root of your monorepo as a `.env` file. + +2. Install `dotenv-cli` in the workspace. + +```json +{ + "scripts": { ++. "dev": "dotenv -e ../../.env start-server" + } + "devDependencies": { ++ "dotenv-cli": "latest" + }, +} +```