Official command-line interface for Env.Guards.
Env.Guards is a complete system for managing secrets. The CLI is the primary tool for developers to securely run their applications without needing .env files.
-
Management via the Dashboard: A user signs up and manages their secrets using the Env.Guards Frontend. They create Organizations, Projects, Environments, and Services.
-
Local Development & CI/CD with the CLI: As a developer, you use this CLI to:
- Log in to your Env.Guards account (
envguards login). - Request access to secrets for a specific service (
envguards request-runtime-key). - Once approved by a team member, run your application with secrets securely injected (
envguards run -- ...).
- Log in to your Env.Guards account (
-
Server-Side Integration with the SDK: For applications that need to fetch secrets directly at runtime (e.g., serverless functions), the
@rusamer/envguardsSDK is used instead of the CLI. Built for secure runtime secrets injection and team workflows (RBAC + approvals) without printing or persisting secrets.
- Backend: Control Plane (CP) + Data Plane (DP)
- Dashboard: approve devices + requests
- CLI: login + request access + run apps with injected env
- SDK:
@rusamer/envguardsis used internally by the CLI for Data Plane secret retrieval
npm i -g @rusamer/envguards-clinpm i -D @rusamer/envguards-cli
# or
pnpm add -D @rusamer/envguards-cliRun locally:
npx envguards --help
# or
pnpm envguards --helpThe CLI targets your Env.Guards backend via ENV_GUARDS_API_URL.
Default: http://localhost:3000
PowerShell:
$env:ENV_GUARDS_API_URL="https://your-backend.example.com"Bash:
export ENV_GUARDS_API_URL="https://your-backend.example.com"- Device login (Vercel-style): CLI gets a short CP token only after browser approval.
- Runtime keys are show-once: approver sees the raw API key once; later only prefix.
- No secrets printed by default:
runinjects into a child process env only. - Local storage: CLI stores tokens/keys locally (do not commit them).
envguards loginThe CLI prints a user_code and verification_url. Open the URL, enter the code, approve the device.
You can list and choose scope:
envguards orgs
envguards projects --org <org-id>envguards request-runtime-key \
--org <org-id> \
--project <project-id> \
--env <env-id> \
--service <service-id> \
--reason "CI runtime access"A Maintainer/Owner approves in the dashboard.
Copy the key from the approval (shown once), then store it locally:
envguards add-runtime-key \
--org <org-id> \
--project <project-id> \
--env <env-id> \
--service <service-id> \
--key envguards_sk_XXXXXXXXXXXXXXXXXXXXXXXXenvguards run \
--org <org-id> \
--project <project-id> \
--env <env-id> \
--service <service-id> -- \
node -e "console.log('HAS_SECRET=', Boolean(process.env.MY_SECRET))"This does not print secret values. It injects them into the child process environment only.
Start device login flow.
envguards loginShow the current user.
envguards whoamiList organizations you belong to.
envguards orgsList projects within an org.
envguards projects --org <org-id>Create an access request for a scoped runtime key (CP). Requires Maintainer/Owner approval.
envguards request-runtime-key \
--org <org-id> \
--project <project-id> \
--env <env-id> \
--service <service-id> \
--reason "Your reason here"List access requests (no secret values are shown). Optionally filter by status.
envguards requests --org <org-id>
envguards requests --org <org-id> --status PENDING
envguards requests --org <org-id> --status APPROVED
envguards requests --org <org-id> --status DENIEDStore an approved runtime key locally for a scope. Used by run/export/env-example.
envguards add-runtime-key \
--org <org-id> \
--project <project-id> \
--env <env-id> \
--service <service-id> \
--key envguards_sk_XXXXXXXXXXXXXXXXXXXXXXXXFetch secrets securely and inject into a child process environment.
Default: no printing, no writing to disk
Flags:
--overrideallow overwriting existing env vars--print-keysprint keys only (no values)
envguards run --org <org> --project <project> --env <env> --service <service> -- \
node -e "console.log(Object.keys(process.env).includes('MY_SECRET'))"Safe export. Redacted by default. Use --plain to output real values (requires confirmation or --yes).
# Redacted dotenv to STDOUT
envguards export --org <org> --project <project> --env <env> --service <service> --format dotenv
# Plain JSON to a file (dangerous)
envguards export --org <org> --project <project> --env <env> --service <service> \
--format json --plain --out secrets.json --yesGenerate .env.example (keys only; no values). Defaults to STDOUT.
envguards env-example --org <org> --project <project> --env <env> --service <service> --out .env.exampleCheck local auth status and connectivity.
envguards statusLog out and clear local credentials.
envguards logoutCLI is for build/runtime injection, but you must decide where the runtime key lives:
- Preferred: obtain key via approval, store it as a secure secret in your CI provider, then use
envguards run. - Never commit runtime keys or tokens to git.
Example (CI):
envguards add-runtime-key --org $ORG --project $PROJECT --env $ENV --service $SERVICE --key "$ENV_GUARDS_RUNTIME_KEY"
envguards run --org $ORG --project $PROJECT --env $ENV --service $SERVICE -- pnpm start- Login approved but no token:
- Ensure backend
/cp/device/tokenreturnscp_access_token. - Ensure
ENV_GUARDS_API_URLis correct.
- Ensure backend
- 401 / session expired:
- Re-run
envguards login.
- Re-run
- Targeting wrong backend:
- Set
ENV_GUARDS_API_URLexplicitly.
- Set
- Request approved but key missing:
- Approve returns raw
api_keyonly once. After that, onlyapi_key_prefixis returned.
- Approve returns raw
Made by Rusamer Email: rusamer@gmail.com