CLI · env

cem add env

Add one or many environment variables everywhere they need to exist — in a single command.

bash
# Single variable
cem add env RESEND_API_KEY

# Batch — add many at once
cem add env RESEND_API_KEY STRIPE_SECRET_KEY CORS_ORIGIN

What gets updated

The CLI atomically updates three locations so nothing drifts:

  1. .env — appends RESEND_API_KEY=<your_resend_api_key>
  2. .env.example — appends RESEND_API_KEY=
  3. src/app/config/index.ts — adds a typed entry, normalised to lower_snake_case:
src/app/config/index.tsts
export default {
  // ...
  resend_api_key: process.env.RESEND_API_KEY,
  stripe_secret_key: process.env.STRIPE_SECRET_KEY,
};

From anywhere in your app, you now have type-safe access:

ts
import config from '@/app/config';

await resend.send({ apiKey: config.resend_api_key, /* ... */ });

Removing variables

bash
# Single
cem remove env RESEND_API_KEY

# Batch
cem remove env CORS_ORIGIN BCRYPT_ROUNDS PASSWORD_RESET_SECRET

# alias
cem rm env CORS_ORIGIN BCRYPT_ROUNDS

Scrubs each key from all three locations — no orphan references left behind.