Overview
share-env (env-share) eliminates the insecure practice of sharing .env files over Slack, Discord, email, or any messaging platform. It encrypts your environment variables on your local machine before they leave your computer, uploads only the ciphertext to a temporary zero-knowledge relay server, and gives you a one-time share code to pass to your teammate.
The relay server permanently deletes the payload the moment it is pulled. The relay never receives the decryption key — it only ever stores unreadable ciphertext.
https://env-share-1rsi.onrender.com — runs on Render. You can self-host your own relay.Prerequisites
# Add to your .gitignore before running share-env .env .env.*
Quick Start
No installation required. Run directly with npx.
$ npx share-env push
$ npx share-env pull <share-code>
push
Encrypt and upload the local .env file to the relay server. Returns a one-time share code.
$ npx share-env push [options]
| Option | Type | Default | Description |
|---|---|---|---|
-f, --file <path> | string | .env | Path to the .env file to share |
--server <url> | string | https://env-share-1rsi.onrender.com | Relay server base URL |
# Share the default .env in the current directory $ npx share-env push # Share a file at a custom path $ npx share-env push --file ./config/.env.production # Use a custom self-hosted relay server $ npx share-env push --server https://your-relay.example.com
3 key(s) loaded from .env Encrypted payload stored on relay. Payload uploaded. Your share code: +--------------------------------------------------+ | apple-brave-cloud#a3f9b2c1d4e5f6a7b8c9d0e1f2... | +--------------------------------------------------+ Send the code above to your teammate. It expires in 10 minutes. One-time use — it is deleted from the relay after the first pull.
pull
Download, decrypt, and merge a shared .env file from the relay server.
$ npx share-env pull <share-code> [options]
| Argument | Required | Description |
|---|---|---|
share-code | Yes | Full share code from the sender — format: phrase#hexKey |
| Option | Type | Default | Description |
|---|---|---|---|
-f, --file <path> | string | .env | Target path to write the decrypted .env |
--server <url> | string | https://env-share-1rsi.onrender.com | Relay server base URL |
# Pull into the default .env in the current directory $ npx share-env pull apple-brave-cloud#a3f9b2c1... # Pull into a custom file path $ npx share-env pull apple-brave-cloud#a3f9b2c1... --file ./config/.env.local # Pull using a custom relay server $ npx share-env pull apple-brave-cloud#a3f9b2c1... --server https://your-relay.example.com
Step-by-step workflow
Complete walkthrough for two developers sharing a .env file.
Before anything else, Developer B verifies their local .gitignore contains the required rules. The tool refuses to run on either side if these are missing.
.env .env.*
Developer A opens a terminal and changes to the root of the project where the .env file is located.
$ cd /path/to/your/project
The tool validates .gitignore, reads .env, generates a 256-bit AES key locally, encrypts the file, uploads only ciphertext to the relay, and returns a share code.
$ npx share-env push
Copy the full share code and send via Slack, Signal, Teams, or any channel. The code is safe to send — the relay only ever saw the identifier portion, not the key after #.
apple-brave-cloud#a3f9b2c1d4e5f6a7b8c9d0e1f2a3b4c5d6e7...
$ cd /path/to/your/project
The tool validates .gitignore, fetches the encrypted payload, the relay immediately deletes it, decrypts locally, and writes or merges the .env file.
$ npx share-env pull apple-brave-cloud#a3f9b2c1...
Smart merge
If Developer B already has a local .env file, share-env does not overwrite it blindly. It compares each key interactively and asks for resolution on every conflict.
Existing .env found — starting merge... Conflict: DATABASE_URL Local : postgres://localhost:5432/mydb Remote : postgres://prod-host:5432/mydb ? Which value do you want to keep? > Keep local Use remote Done! .env written to: /path/to/your/project/.env
Custom file paths
Use --file (or -f) on both sides to work with staging, production, or any custom-named env file.
# Sender — share a staging env file $ npx share-env push --file .env.staging # Receiver — write to the same path $ npx share-env pull <code> --file .env.staging
Self-hosting the relay
Run your own relay for full infrastructure control. See the self-hosting guide for the complete setup. The short version:
$ git clone https://github.com/arjunn881/env-share.git $ cd env-share $ npm install $ npm run build $ npm start --workspace=server # Use your relay: $ npx share-env push --server https://your-relay.example.com $ npx share-env pull <code> --server https://your-relay.example.com