Skip to main content
AI Production Partnerby GO Along

DevOps

Environment Variables and Secret Management, Done Right

From .env files to secret managers: how production apps should store configuration and credentials, and the migration path from what your AI tool generated.

By AI Production Partner · · 3 min read

The maturity ladder

Level zero: secrets hardcoded in source (where AI-generated apps start). Level one: a .env file — better, but it's on disk, in backups, and one 'git add .' from history. Level two: platform environment variables (host-provided config) — the minimum for production. Level three: a secret manager (cloud-native or Vault) with access control, audit logging, and rotation — where anything holding customer data should be.

Most teams should land at level three for credentials and level two for non-sensitive config. The distinction matters: a feature flag and a database password don't deserve the same handling.

The rules that prevent incidents

Secrets never enter git — enforce with CI secret scanning, not intention. Different credentials per environment, so a leaked staging key can't touch production data. Rotation is routine, not emergency-only — if rotating a credential frightens the team, that's the signal it's overdue. And client-side code gets no secrets at all: anything shipped to a browser is public, including the 'private' keys AI tools happily embed in React components.

Migrating a generated app

The path we run in engagements: scan history for what's already exposed, rotate all of it, move config to environment variables with a validated schema (fail fast on missing config at boot, not at 2 a.m.), then graduate credentials into a secret manager with per-service access. A day or two of work, and the single highest-leverage security upgrade most AI-built apps can make.

Ready to take your AI-built app to production?

Get a free, no-obligation production assessment. We review your architecture, security posture, and deployment readiness — and give you a concrete roadmap within 48 hours.

Response within one business day · NDA available · No lock-in