dotswitch
CLI Tool for Developers

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 dotswitch

Or use directly without installing: npx dotswitch use staging

terminal

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 staging

List Environments

dotswitch ls

Show Current

dotswitch current

Restore Backup

dotswitch restore

Compare Environments

dotswitch diff staging production

Dry Run

dotswitch use staging --dry-run

Ready to simplify your workflow?

Get started in seconds. No configuration required.