Quickly switch between .env files
Copies .env.<environment> to .env.local and tracks the active environment. Works with Next.js, Vite, Remix, and any project that uses .env files.
npm install -g dotswitchOr use directly without installing: npx dotswitch use staging
Everything you need
Simple CLI
Switch environments with a single command. Interactive picker when no environment is specified.
Git Hook Support
Auto-switch environments when checking out branches. Configure branch-to-env mappings.
Monorepo Ready
Switch environments across multiple packages at once using glob patterns.
Automatic Backups
Your existing .env.local is backed up automatically before switching. Restore anytime.
Diff Environments
Compare two environments to see what keys differ. Show values or just key names.
Programmatic API
Use dotswitch functions in your own scripts and tools. Full TypeScript support.
Quick Reference
Switch Environment
dotswitch use stagingList Environments
dotswitch lsShow Current
dotswitch currentRestore Backup
dotswitch restoreCompare Environments
dotswitch diff staging productionDry Run
dotswitch use staging --dry-runReady to simplify your workflow?
Get started in seconds. No configuration required.