Repo
Docs
Environment Variables

Using environment variables

We currently recommend using dotenv-cli as the simplest way to bring your environment variables into your development tasks.

We're actively looking forward to improving the developer experience and ergonomics for your environment variables in a future release of Turborepo.

With local turbo

  1. Place all of your variables into the root of your monorepo as a .env file.

  2. Install dotenv-cli into the root of your repository.

{
   "devDependencies": {
+    "dotenv-cli": "latest"
  }
}
  1. Adjust your scripts to inject the environment variables into the turbo command.
{
  "scripts": {
    "dev": "dotenv -- turbo dev"
  }
}

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.

Last updated on 2023-01-30T17:30:35.000Z