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.exampledocuments every key (generator).
Follow .env best practices and you avoid most incidents without extra infrastructure.
What a secrets manager adds
| Capability | Why it matters |
|---|---|
| Central store per environment | one source of truth instead of copies on laptops |
| Access control (RBAC) | contractors see dev, only a few people see production |
| Audit log | who read or changed which secret, when: evidence for SOC 2 / ISO 27001 audits |
| Rotation | change a key once, every service picks it up |
| Dynamic secrets | short-lived database or cloud credentials per service (Vault, cloud IAM) |
| Integrations | push values into CI, Kubernetes and hosting platforms |
The main options
| .env | Doppler | Infisical | Vault / OpenBao | AWS / GCP / Azure | |
|---|---|---|---|---|---|
| Model | file | SaaS | open source, cloud or self-hosted | self-hosted (Vault also as HCP) | cloud service |
| Ops effort | none | low | low (cloud) / medium | high | low |
| Access control + audit | no | yes | yes | yes | yes (IAM, CloudTrail etc.) |
| Dynamic secrets | no | no | limited | yes | via IAM roles |
| Self-hosting | n/a | no | yes | yes | no |
| Licence | open source | proprietary | open source (MIT core) | Vault: BSL; OpenBao: open source | proprietary |
- 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
- Scan the current files with the ENV leak checker and rotate anything that was ever shared in plain text.
- Create environments (dev, staging, prod) and import each
.env. - Replace file loading with the manager's CLI wrapper or SDK, locally and in CI.
- Connect host and Kubernetes integrations so deploys receive values automatically.
- Keep
.env.examplefor documentation; delete real.envfiles 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.