Real-time Sync (Dev Mode)
The envmanager dev command watches for changes in EnvManager and automatically updates your local .env file in real-time. No more manual pulls when teammates update variables.
Basic Usage
envmanager dev
This starts a daemon that:
- Performs an initial sync of all variables
- Connects to EnvManager's real-time service
- Updates your local
.envwhen changes are detected - Shows changes in the terminal
Output:
Dev mode started
Project: my-app
Environment: development
Output: .env
Strategy: remote_wins
Watching: local + remote
Watching for changes. Press Ctrl+C to stop.
[14:32:05] + NEW_VAR
[14:33:12] ~ API_URL
[14:35:44] - OLD_VAR
Options
| Option | Description |
|---|---|
-e, --environment <name> | Environment name (default: from config) |
-p, --project <id> | Project ID (default: from config) |
-o, --output <file> | Output file path (default: .env) |
--no-watch | Disable local file watching |
--strategy <type> | Merge strategy (see below) |
Merge Strategies
When both local and remote changes occur, the CLI uses a merge strategy to resolve conflicts.
remote_wins (default)
Remote changes always overwrite local. Best for keeping in sync with your team.
envmanager dev --strategy remote_wins
local_wins
Local changes are preserved, only new remote variables are added.
envmanager dev --strategy local_wins
merge_new
Only add new variables from remote, never modify existing local values.
envmanager dev --strategy merge_new
How It Works
- Initial Sync: On startup, variables are fetched and merged with your local
.env - Real-time Connection: A WebSocket connection is established to EnvManager
- Change Detection: When a variable is added, updated, or deleted remotely:
- The CLI receives a notification
- It fetches the full updated variable (secrets are decrypted)
- Your local
.envis updated according to the merge strategy
- Local Watching: By default, local
.envchanges are also detected (for logging)
Stopping Dev Mode
Press Ctrl+C to gracefully stop:
^C
Stopping dev mode...
Press Ctrl+C twice to force stop immediately.
Use Cases
Team Development
When multiple developers work on the same project, changes made by one developer are instantly available to others:
Developer A adds DATABASE_URL in web UI
↓
Developer B's terminal shows: [14:32:05] + DATABASE_URL
↓
Developer B's .env is automatically updated
Environment Switching
Quickly switch between environments during development:
# Work on staging
envmanager dev --environment staging
# Switch to production (in another terminal)
envmanager dev --environment production --output .env.production
Multiple Projects
Run dev mode for multiple projects simultaneously:
# Terminal 1: Backend
cd backend && envmanager dev
# Terminal 2: Frontend
cd frontend && envmanager dev
Troubleshooting
Connection Lost
If the real-time connection drops, the CLI automatically reconnects:
Disconnected from realtime
Reconnecting...
Realtime connected
Variables Not Updating
- Check you have access to the environment:
envmanager list variables - Verify the correct environment:
envmanager config get environment - Check the merge strategy isn't blocking updates:
envmanager dev --strategy remote_wins
High CPU Usage
If file watching causes issues, disable local watching:
envmanager dev --no-watch