Environment Variables

Learn how to use environment variables in your Next.js project.

The starter project comes with two different environment variables files:

  1. .env: the main environment file
  2. .env.development: the development environment file (used when running the project locally in development mode)
  3. .env.production: the production environment file (used when deploying or running the build command)
  4. .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.
  5. .env.test: this environment file is loaded when running the Cypress E2E tests. You would rarely need to use this.

The default environment variables for the production environment are:

NEXT_PUBLIC_SITE_URL=
ENVIRONMENT=production
 
# SUPABASE
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_REQUIRE_EMAIL_CONFIRMATION=true
 
# SERCET KEY TO SIGN SECRETS. REPLACE THE BELOW WITH A RANDOM AND COMPLEX STRING. KEEPT IT SAFE.
SECRET_KEY=
 
# STRIPE
STRIPE_WEBHOOK_SECRET=
STRIPE_SECRET_KEY=

Subscribe to our Newsletter
Get the latest updates about React, Remix, Next.js, Firebase, Supabase and Tailwind CSS