EnvHub is a powerful, lightweight terminal-based tool for managing environment variables across different applications and profiles. It allows you to switch between development, staging, and production environments seamlessly without manually editing files or managing complex shell scripts.
- ๐ฅ๏ธ Interactive TUI: A beautiful terminal user interface built with
ratatui. - ๐ Profile Switching: Instantly switch environment profiles (Dev/Prod/Staging) for any application.
- ๐ Zero Overhead: The launcher is written in Rust for minimal latency and extreme performance.
- ๐ ๏ธ Automatic Shims: Automatically manages binary wrappers so you don't have to change your workflow.
- ๐ฆ Cross Platform: Works on macOS (Intel & Apple Silicon) and Linux.
The easiest way to install EnvHub is via the one-line installer:
curl -fsSL https://raw.githubusercontent.com/sontallive/envhub/main/install.sh | shSupported Platforms: macOS (Intel & Apple Silicon), Linux
-
Launch EnvHub: Type
envhubin your terminal to open the TUI. -
Add an App: Press
Ato register a new application. Important: The app name you enter acts as an alias (a new command name) that EnvHub will manage.Best Practice: Use a different name from the original command to keep both versions available. For example:
- Original command:
claudeโ EnvHub alias:iclaudeorclaudex - Original command:
nodeโ EnvHub alias:inodeornodex
This way, you can use
claudefor the original command andiclaudewhen you need EnvHub's environment management.How it works: When you add an alias called
iclaude, EnvHub creates a shim executable with that name. When you runiclaudein your terminal, EnvHub's wrapper will execute, inject the environment variables from your active profile, and then call the originalclaudebinary.Critical: When prompted for the "target binary", you must provide the full path to the original command (use
which claudeto find it, e.g.,/usr/local/bin/claude). - Original command:
-
Define Profiles: Create profiles like
devorprodand add your environment variables. -
Use Your Alias: Once an app is managed by EnvHub, use the alias you created:
# If you created an alias 'iclaude' for 'claude': iclaude /status # Uses EnvHub's environment variables # The original command still works without EnvHub: claude /status # Uses default environment
Claude Code is a powerful agentic CLI tool. With EnvHub, you can easily switch between the official Anthropic API, third-party providers (like Z.AI), or self-hosted relays (like CRS), without manually editing configuration files.
- Alias:
iclaude(orclaudex,myclaude- choose any name you like) - Target Binary:
/usr/local/bin/claude(usewhich claudeto find your path) - Usage: Run
iclaude codeto use EnvHub-managed profiles,claude codefor original behavior - Profiles:
official:ANTHROPIC_AUTH_TOKEN:sk-ant-xxx
zai-glm(High cost-performance):ANTHROPIC_AUTH_TOKEN:your_zai_api_keyANTHROPIC_BASE_URL:https://api.z.ai/api/anthropicANTHROPIC_DEFAULT_SONNET_MODEL:glm-4.7ANTHROPIC_DEFAULT_HAIKU_MODEL_:glm-4.5-airANTHROPIC_DEFAULT_OPUS_MODEL:glm-4.7
crs-relay(Self-hosted / Shared):ANTHROPIC_AUTH_TOKEN:your_crs_keyANTHROPIC_BASE_URL:http://your-relay-server:3000/api/
Avoid manually exporting AWS_PROFILE or keys. Define profiles for different accounts or environments.
- App:
aws - Profiles:
work-dev,work-prod,personal-oss.
Ensure your migration scripts or CLI clients always hit the right database.
- App:
psql,prisma,supabase - Profiles:
local,staging,production.
EnvHub consists of three main components:
envhub-core: The logic engine that manages state and configuration.envhub-tui: The interactive interface for managing your apps and variables.envhub-launcher: A high-performance shim that intercepts command calls and injects the correct environment variables.
- App Registration: When you add an app in EnvHub, you provide two things:
- Alias name: A new command name (e.g.,
iclaude,inode) that you'll use to invoke the managed version - Target binary: The full path to the original executable (e.g.,
/usr/local/bin/claude)
- Alias name: A new command name (e.g.,
- Shim Creation: EnvHub creates a lightweight binary shim with the alias name in its managed directory.
- Dual Access: After installation:
- Running your alias (e.g.,
iclaude) โ uses EnvHub with environment variable injection - Running the original command (e.g.,
claude) โ works normally without EnvHub
- Running your alias (e.g.,
- Interception & Injection: When you run the alias, the shim reads your active profile from EnvHub's config, injects the environment variables, and then executes the target binary you specified.
- Zero Overhead: The launcher is written in Rust and adds less than 1ms of latency, making it imperceptible in daily use.
Key Points:
- Recommended: Use a different alias name (e.g.,
iclaudeinstead ofclaude) to keep both managed and unmanaged versions available. - The target binary must be a full path to avoid resolution issues. Use
which <command>to find the original binary's location before registering. - You choose the alias nameโit can be anything you like (e.g.,
myclaude,claudex,inode,mynode).
If you want to build from source:
# Clone the repository
git clone https://github.com/sontallive/envhub.git
cd envhub
# Build all components
cargo build --release
# Run the TUI
cargo run -p envhub-tuiThis project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Built with โค๏ธ using Rust.
