# Environment Variables
You can provide environment variables to each side of your Redwood project in different ways, depending on your target.
On the API side with NodeJS as your target, you can access the environment variables defined in your
.env.defaults file and referencing them in your code as
Your deployment system will need some way to make environment variables available to the serverless environment where your functions will run. For example on Netlify you can set them in the Build environment variables section of your Settings.
On the Web side, with webpack as your target, you can do one of three things:
Prefix your env vars with
REDWOOD_ENV_—they will be available via
process.env.REDWOOD_ENV_MY_VAR_NAMEand will be dynamically replaced during the build phase. This means that
Whitelist them in your
redwood.toml. For example:
[web] includeEnvironmentVariables = ['API_KEY']
These will also be substituted in your code as in the first option above.
Define them in your
.envfile. This will only work in the development environment and will either cause an error or fail silently in production, depending on where your ENV var is referenced.