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
npm install -g remotevarsor for local development:
npm install remotevars --save-devnpx remotevars pull --provider=github --repo=myorg/configs --path=envs/dev.jsonnpx remotevars load --provider=http --url=https://example.com/config.jsonnpx remotevars print --provider=local --path=./envs/dev.jsonnpx remotevars clear-cacheCreate a .remotevars.json in your project root to define your preferred provider(s):
{
"defaultProvider": "github",
"useCache": true,
"github": {
"repo": "myorg/myconfigs",
"path": "envs/dev.json",
"branch": "main",
"token": "ghp_XXXXXXX"
},
"http": {
"url": "https://example.com/config.json"
},
"local": {
"path": "./envs/dev.json"
}
}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.
| Provider | Description | Required Options |
|---|---|---|
| github | Fetch from a GitHub repository | repo, path, optional branch, token |
| http | Fetch from any HTTP/HTTPS endpoint returning JSON | url |
| local | Load from a local JSON file | path |
| s3 | Fetch from a GitHub repository | bucket, key, optional region, token |
You can also use RemoteVars directly in your code:
import { loadRemoteVars } from "remotevars";
await loadRemoteVars({
provider: "github",
repo: "myorg/myconfigs",
path: "envs/dev.json",
token: process.env.GH_TOKEN,
useCache: false
});
console.log(process.env.API_KEY);Run unit tests:
npm test- ๐ Add encrypted secrets support
- โ๏ธ Add AWS S3 and GCP provider support
- ๐งฉ Add
.remotevarsrcglobal configuration
Created by Jose R. Garcia
๐ฆ GitHub: @jrgf
MIT License โ feel free to use, modify, and distribute.
RemoteVars โ Your environment, remotely controlled.