RemoteVars is a modern Node.js library and CLI tool that lets you manage environment variables from remote sources β like GitHub, HTTP endpoints, or local JSON files β eliminating the need for .env files in your projects.
- π Load configuration securely from:
- GitHub repositories (private or public)
- HTTP(S) endpoints
- Local JSON files
- π§ Optional local cache for offline resilience
- βοΈ CLI tool for pulling, printing, and loading variables
- π» Works with Node.js, Express, React, or any framework
- βοΈ Perfect for distributed teams and CI/CD setups
Requires Node.js 18 or newer.
npm install -g remotevarsor for local development:
npm install remotevars --save-devnpx remotevars pull --provider=github --repo=myorg/configs --path=envs/dev.jsonnpx remotevars run production -- node server.jsThe variables are passed only to the child process. RemoteVars does not write a .env file. The old load command cannot change its parent shell and is deprecated.
npx remotevars print --provider=local --filePath=./envs/dev.jsonValues are replaced with [REDACTED]. Add --show-values to reveal them.
npx remotevars clear-cacheDefine environments in .remotevars.json:
{
"defaultEnv": "dev",
"useCache": true,
"cacheTtl": 300,
"environments": {
"dev": {
"provider": "local",
"filePath": "./envs/dev.json"
},
"production": {
"provider": "github",
"repo": "myorg/myconfigs",
"path": "envs/production.json",
"branch": "main",
"tokenEnv": "GITHUB_TOKEN"
}
}
}You can disable the caching system globally or per command.
{
"useCache": false
}npx remotevars pull --no-cacheWhen cache is disabled, RemoteVars always fetches fresh data from the provider and never stores or reads from the cache.
cacheTtl is the maximum cache age in seconds. Expired entries are ignored unless the command includes --allow-stale.
| Provider | Description | Required Options |
|---|---|---|
| github | Fetch from a GitHub repository | repo, path, optional branch, tokenEnv |
| http | Fetch from an HTTP endpoint returning JSON | url, optional tokenEnv |
| local | Load from a local JSON file | filePath |
You can also use RemoteVars directly in your code:
import { loadRemoteVars } from "remotevars";
await loadRemoteVars({
provider: "github",
repo: "myorg/myconfigs",
path: "envs/dev.json",
tokenEnv: "GITHUB_TOKEN",
useCache: false
});
console.log(process.env.API_KEY);Run unit tests:
npm testSee ROADMAP.md for planned releases and priorities.
Created by Jose R. Garcia
π¦ GitHub: @jrgf
MIT License β feel free to use, modify, and distribute.
RemoteVars β Your environment, remotely controlled.