🚀

Environment Variable Setup Guide

Set up environment variables properly across development, staging, and production

prompt template
Set up environment variable management for my [FRAMEWORK] project.

**Services I use:** [LIST — e.g., "PostgreSQL, Stripe, SendGrid, AWS S3, OpenAI"]
**Deployment:** [WHERE — e.g., "Vercel", "AWS", "Railway"]

Generate:
1. **.env.example** — every variable with a description comment and dummy value
2. **Validation schema** — runtime validation that fails fast on missing vars (use zod)
3. **Type-safe access** — a typed env config object (not raw process.env everywhere)
4. **.gitignore rules** — ensure no secrets leak
5. **Setup guide** — step-by-step for a new developer to get all keys

```typescript
// Example of what I want:
import { env } from '@/lib/env';
env.DATABASE_URL  // string (validated at startup)
env.STRIPE_SECRET // string (validated at startup)
```

For each variable:
- Name, description, where to get it
- Is it required or optional?
- Different values per environment (dev/staging/prod)?
- Client-safe (NEXT_PUBLIC_) or server-only?

Include a warning system that logs which optional vars are missing at startup without crashing.

How to Use This Prompt

  1. 1Copy the prompt template above
  2. 2Paste into Claude, ChatGPT, or Cursor
  3. 3Replace [bracketed placeholders] with your specific project details
  4. 4Iterate on the AI output to refine and customize the results