Environment Files

One file to rule them all

Our codebase utilizes only one .env file.

When first creating a new project for a client, all environment variables that are created should also be added to the environment variables list in the vercel account for the given project. (This can be found under the settings tab).

This allows other Gearbox team members to hop on the project if need be and easily add everything they need to their local environment through the Vercel CLI.

Pulling down environment variables to your local environment can be achieved in a few quick steps:

  • Install the CLI if you haven't already -> yarn global add vercel@latest

  • Link your project to it's Vercel instance -> vercel link

  • Type Y to accept.

  • Select Vercel profile that contains the project (99% of the time it will be Gearbox Built).

  • If it exists, it will prompt you to link to the project.

Once linked, you can use vercel env pull to pull the environment variables.

That's it! 🎉


❗Don't forget to run yarn install before yarn start


If you've followed all the steps above and still can't get it to work locally, make sure that all variables that have the SANITY_STUDIO prefix are listed at the end, to ensure proper injection at build time. Move them to the end, then try again.

💡
See something that is out of date or that could be improved?Please let the team know!1. You can create a Github issue2. Pull down the repo and create a PR with your suggested changes implimented.3. Or just let someone know in the R&P Slack Channel.We love making things better.