Environment Variables
Addfox uses Rsbuild's loadEnv to load .env files from the project root, and by default only exposes variables starting with ADDFOX_PUBLIC_ to client code.
Default Behavior
- Default Prefix:
ADDFOX_PUBLIC_ - Client Code: background, content, popup, options, sidepanel, devtools entries
- Loaded Files:
.env,.env.local,.env.{mode},.env.{mode}.local
Scope
Environment variables are injected into all client code entries, but not in the manifest configuration in addfox.config.ts (which uses build-time environment).
Built-in Variables
Addfox automatically injects these variables:
Usage Example
.env File
Using in Code
Security Recommendations
- Always use
ADDFOX_PUBLIC_prefix to mark variables safe for client exposure - Sensitive info (like API keys) should not start with
ADDFOX_PUBLIC_ .env.localand.env.{mode}.localfiles should not be committed to Git
Related Documentation
- guide/env-prefix - Environment variables usage guide

