Like most developers, our team relied on .env files for years. It felt simple: create a .env.local, put your API keys in it, and add it to .gitignore.
In practice, that system always breaks:
- The Slack DM leak: When a new engineer joins, someone pastes the staging database URL into a private Slack thread.
-
The Git commit accident: A developer renames a file or initializes a new subfolder, forgets to add
.envto.gitignore, and pushes production keys to GitHub. - Environment drift: Staging has variables that dev doesn't, causing the classic "it worked on my machine" outage.
The In-Memory Approach
Instead of storing secrets in plaintext files on disk, we can fetch encrypted credentials over TLS and inject them directly into the child process memory at runtime.
I built a CLI called Ray Secrets (@rcmade/ray) to make this zero-friction:
# 1. Install & Authenticate
npm install -g @rcmade/ray
ray login
# 2. Link your project (auto-imports existing .env if present)
ray init
# 3. Launch your app with in-memory injection
ray run -e development -- npm run dev
Why this changes local workflow:
-
Zero Disk Exposure: The child process receives
process.envin RAM. Nothing is written to.env. When the server stops, the secrets disappear from memory. -
Local AST Healing: If you still need a local file for legacy tools,
ray syncreconciles differences and automatically repairs broken syntax without stripping comments. - Production Proposals: Changes to production secrets can require review before landing, just like a GitHub Pull Request.
If you're tired of passing around .env files, give it a spin:
- Website: https://secrets.rcmade.io
- CLI:
npm i -g @rcmade/ray
How is your team currently handling local and staging secrets?

Top comments (0)