APP_ENV
.
If APP_ENV
is set to staging, the app will use the variables from the staging file.
.env.development
which has special environment variables just for people who are building the app..env.staging
file which has variables that help us test everything properly..env.production
which has environment variables for the app when it’s being used by everyone.src/config/index.ts
file.
NEXT_PUBLIC_
.Zod
schema.
Identify the Environment Stages
APP_ENV | File |
---|---|
development | .env.development |
staging | .env.staging |
production | .env.production |
Update `.env` Files
.env
files. For client-side variables, prefix them with NEXT_PUBLIC_
.Modify the Schema in `src/config/index.ts`
config/index.ts
file to include the new variable.
This step is crucial for schema validation.Update the Configuration Object
config/index.ts
), ensuring it matches the schema.