Environment Variables
Learn how to use environment variables in your Next.js project.
The starter project comes with two different environment variables files:
- .env: the main environment file - use this for variables that are common to all environments - and that are not secrets.
- .env.development: the development environment file (used when running the project locally in development mode) - when they're specific to the development environment.
- .env.production: the production environment file (used when deploying or running the build command) - when they're specific to the production environment.
- .env.local: this environment file is loaded when running the project locally. It won't be committed to Git. Useful for adding secrets that you don't want to commit to Git.
- .env.test: this environment file is loaded when running the Cypress E2E tests. You would rarely need to use this.