compareBy Aliniyaz Mamat · updated

.env vs a secrets manager (Doppler, Infisical, Vault)

dotenv vs a secrets manager: a .env file is free, simple and works until secrets have to be shared, rotated and audited across a team; a secrets manager (Doppler, Infisical, Vault, AWS/GCP/Azure) adds central storage, access control, audit logs and rotation. Most teams end up using .env locally and a secrets manager or host settings in production.

Key takeaways

  • ✓.env is enough for small teams, few environments, and hosts whose dashboard holds the production values.
  • ✓You need a secrets manager for rotation across services, per-person access, an audit trail, or dynamic short-lived credentials.
  • ✓Hosted (Doppler, Infisical Cloud), self-hosted (Infisical, Vault/OpenBao) and cloud-native (AWS, GCP, Azure) options cover different trade-offs.
  • ✓A secrets manager doesn't stop console.log(process.env); it makes rotation cheap when that happens.
  • ✓Treat it as a dependency: plan for its outage (cached values or build-time sync).

When a .env file is enough

  • One to a few people, who share secrets through a password manager.
  • Values change rarely.
  • Production values live in the host's dashboard (Vercel, Railway, Fly.io, Render).
  • A committed .env.example documents every key (generator).

Follow .env best practices and you avoid most incidents without extra infrastructure.

What a secrets manager adds

CapabilityWhy it matters
Central store per environmentone source of truth instead of copies on laptops
Access control (RBAC)contractors see dev, only a few people see production
Audit logwho read or changed which secret, when: evidence for SOC 2 / ISO 27001 audits
Rotationchange a key once, every service picks it up
Dynamic secretsshort-lived database or cloud credentials per service (Vault, cloud IAM)
Integrationspush values into CI, Kubernetes and hosting platforms

The main options

.envDopplerInfisicalVault / OpenBaoAWS / GCP / Azure
ModelfileSaaSopen source, cloud or self-hostedself-hosted (Vault also as HCP)cloud service
Ops effortnonelowlow (cloud) / mediumhighlow
Access control + auditnoyesyesyesyes (IAM, CloudTrail etc.)
Dynamic secretsnonolimitedyesvia IAM roles
Self-hostingn/anoyesyesno
Licenceopen sourceproprietaryopen source (MIT core)Vault: BSL; OpenBao: open sourceproprietary
  • Doppler: fastest path from .env; doppler run -- npm run dev. Details: dotenv vs Doppler.
  • Infisical: similar workflow, self-hostable, Kubernetes operator.
  • Vault / OpenBao: dynamic credentials, encryption as a service, strict policies; needs people to run it. See Vault alternatives.
  • Cloud-native: natural if everything runs in one cloud; IAM controls access.

Migrating from .env to a secrets manager

  1. Scan the current files with the ENV leak checker and rotate anything that was ever shared in plain text.
  2. Create environments (dev, staging, prod) and import each .env.
  3. Replace file loading with the manager's CLI wrapper or SDK, locally and in CI.
  4. Connect host and Kubernetes integrations so deploys receive values automatically.
  5. Keep .env.example for documentation; delete real .env files from laptops.

The honest trade-off

A secrets manager is one more service that can be down when your app starts. Mitigations: sync secrets into the platform at deploy time instead of pulling at boot, use the CLI's encrypted fallback cache, or run an in-cluster agent/operator. For small teams the extra moving part can outweigh the benefits; for teams with several production services it rarely does.

Frequently asked questions

Can I use a secrets manager for local development too?

Yes: doppler run -- npm run dev or infisical run -- npm run dev give every developer current values. The cost is a network dependency, so some teams keep a .env fallback.

Does a secrets manager stop secrets from being logged?

No. Printing process.env is an application bug. The manager gives you an audit trail and fast rotation once you notice.

Is a secrets manager overkill for a two-person startup?

Usually, at first. Adopt one when you feel the pain: secrets shared by hand, a second production environment, or a compliance requirement.

How long does a migration take?

For a small app, about an hour for import and start commands. Updating CI pipelines and every developer's routine takes longer than the technical part.

Is HashiCorp Vault still open source?

No. Vault moved to the Business Source License in 2023. OpenBao is the community-maintained open-source fork under the Linux Foundation.

Related tools

Continue reading