Dotenvx

Status: Active
Last Updated: 2026-08-26
Category: Sysadmin / Secrets
Prerequisites: sysadmin.md, secrets.md
Tags: dotenvx, secrets, encryption, cli, forgejo-actions

Summary

Dotenvx layers encrypted .env files so secrets can live in Git safely while being decrypted at runtime via CLI commands or CI/CD actions. Migration from dotenv to @dotenvx/dotenvx is a single import change.

Context / Why This Matters

Without encryption, committing .env files leaks secrets; without layered files, local overrides and production configs compete. Dotenvx solves both by splitting encrypted artifacts from decryption keys and supporting multi-file stacks (dev, local, production).

Implementation / Core Content

Core Product Signals

Tooling & Integrations

Operational Controls

Practical Examples

# Local development with local override
dotenvx run --env-file=.env.local -- bun run dev

# Production deploy in Forgejo Actions
- name: Deploy
  run: dotenvx run --env-file=.env.production -- bun run deploy
  env:
    DOTENV_PRIVATE_KEY_PRODUCTION: ${{ secrets.DOTENV_KEY }}

Common Pitfalls & Troubleshooting

Pitfall Fix
.env.keys committed to repo Add .env.keys to .gitignore and rotate the key
Decryption fails in CI Verify DOTENV_PRIVATE_KEY_* is set as a Forgejo secret
Wrong layer applied Confirm --env-file matches the environment; list layers with dotenvx get
Overwriting environment variables unexpectedly Layer order: .env < .env.local < .env.production < runtime env

Next Steps / Ops Actions

  1. Verify .env.keys rotation cadence is documented in sysadmin/secrets.md.
  2. Map Dotenvx commands to Forgejo Actions in sysadmin/system-admin-basics.md.
  3. Confirm encryption workflow is captured in sysadmin/secrets.md.

Sources & Related Articles

Change Log

2026-08-26

Choose Theme

Your selection is saved locally.

Neural Cacophony
Aperture v2
Flux v1
Mosaic Chaos
Nexus v1
Nexus Zest
Prism v2
Synapse