Self-hosting

Run your own relay server.

The share-env relay is open source and can be self-hosted on any platform that runs Node.js 18+. Full control over TTL, rate limits, and infrastructure.

Full infrastructure control
Your relay, your server, your rules. No shared default relay, no dependency on external uptime.
Custom TTL and rate limits
Adjust the 10-minute TTL and 10 req/min rate limit to match your team's needs.
Enterprise & compliance
Teams with strict data residency requirements can keep all env payloads within their own infrastructure.

Requirements

Node.js 18 or higherCheck with: node --version
A server or cloud platform that runs a persistent Node.js processRender (free tier), Railway, Fly.io, or a VPS all work.
Git (to clone the repository)Only needed for setup.

Setup

Four steps — runs in under 2 minutes.

1
Clone the repository
bash
$ git clone https://github.com/arjunn881/env-share.git
cd env-share
2
Install all dependencies
bash
$ npm install
3
Build the server workspace
bash
$ npm run build
4
Start the relay server
bash
$ npm start --workspace=server

# To use a custom port:
PORT=8080 npm start --workspace=server

Using your self-hosted relay

Pass the --server flag to both push and pull:

bash
# Sender
$ npx share-env push --server https://your-relay.example.com

# Receiver
$ npx share-env pull <share-code> --server https://your-relay.example.com

Relay server configuration

These defaults are defined in server/src/index.ts and can be changed when self-hosting:

SettingDefaultDescription
TTL_SECONDS600 (10 minutes)Time before an uncollected payload is automatically deleted from memory
RATE_LIMIT_MAX10Maximum requests per minute per IP address
PORT3000Port the server listens on — overridden by the PORT environment variable
typescript — server/src/index.ts
// Adjust these values in your self-hosted relay
const TTL_SECONDS = 600;       // 10 minutes
const RATE_LIMIT_MAX = 10;    // requests per minute per IP
const PORT = process.env.PORT || 3000;

Recommended deploy platforms

RenderFree tier

Push the repo to GitHub, connect to Render, set build command to npm run build and start command to npm start --workspace=server.

render.com →
RailwayFree tier

Connect GitHub repo, Railway auto-detects Node.js. Set the start command and PORT environment variable.

railway.app →
Fly.ioFree tier

Use fly launch and fly deploy. The server runs as an always-on Fly Machine. Supports custom domains.

fly.io →
VPS (any cloud)Self-managed

SSH into your server, clone the repo, run npm install && npm run build, then use PM2 to keep the process alive.

Project structure

repository structure
env-share/
  cli/          — The npm CLI package (share-env)
    src/
      index.ts            — CLI entry point and command definitions
      utils/
        crypto.ts         — AES-256-GCM encrypt/decrypt logic
        env.ts            — Smart merge logic
        env-validator.ts  — .env file format validation
        git.ts            — .gitignore safety check
  server/       — The Express relay server
    src/
      index.ts            — Server entry point, routes, rate limiting
The default relay server https://env-share-1rsi.onrender.com is provided free of charge on Render's free tier. It may experience cold-start latency (15–30s on first request after inactivity). Self-hosting avoids this.