Skip to content

Secure P2P environment variable sharing for teams. Auto-discover peers on your network, share .env files instantly. No cloud required.

Notifications You must be signed in to change notification settings

Justinkarso/EnvShare

Repository files navigation

EnvShare

Secure P2P environment variable sharing for teams. No more secrets in Slack.

EnvShare

Features

  • End-to-End Encryption - Secrets are encrypted before leaving your machine
  • P2P Sharing - Direct peer-to-peer on local networks, no cloud required
  • Auto-Discovery - Automatically finds teammates on the same network via mDNS
  • Web Interface - Modern browser UI, no CLI commands needed
  • Collections - Organize env vars by project or environment
  • Real-time Sync - Changes propagate instantly to connected peers

Quick Start

git clone https://github.com/yourname/envshare.git
cd envshare

pnpm install

pnpm start

Your browser opens to http://localhost:3847

Development

# Development mode with hot reload
pnpm dev

# Build for production
pnpm build

# Start production server
pnpm serve

Testing Multiple Instances

To simulate two users on one machine:

# Run both Alice and Bob instances
pnpm run test:both

Or run them separately:

# Terminal 1 - Alice on port 3847
pnpm run test:alice

# Terminal 2 - Bob on port 3848
pnpm run test:bob

Docker

Build the Image

docker build -t envshare .

Run a Single Instance

docker run -d \
  --name envshare \
  -p 3847:3847 \
  -v envshare-data:/root/.envshare \
  envshare

Run Persistently (Auto-restart)

docker run -d \
  --name envshare \
  --restart unless-stopped \
  -p 3847:3847 \
  -v envshare-data:/root/.envshare \
  envshare

Docker Compose

Create a docker-compose.yml:

version: '3.8'

services:
  envshare:
    build: .
    container_name: envshare
    restart: unless-stopped
    ports:
      - "3847:3847"
    volumes:
      - envshare-data:/root/.envshare
    network_mode: host  # Required for mDNS peer discovery

volumes:
  envshare-data:

Run with:

docker compose up -d

Note: network_mode: host is required for mDNS peer discovery to work across the local network.

Project Structure

envshare/
├── apps/
│   ├── server/     # Express backend + P2P networking
│   └── web/        # React frontend
├── packages/
│   └── shared/     # Shared TypeScript types
└── package.json

Security

EnvShare uses:

  • TweetNaCl for encryption (XSalsa20-Poly1305)
  • Scrypt for key derivation
  • SQLite for local storage
  • Team keys for shared access (generate once, share out-of-band)

Your secrets never leave your network unencrypted.

How It Works

  1. Initialize - Create a team and generate a team key
  2. Import - Drag and drop your .env files into collections
  3. Share - Collections are automatically available to peers
  4. Pull - One-click pull from any discovered peer

Local Network Mode

EnvShare uses mDNS (Bonjour/Avahi) to discover peers on your local network automatically.

Remote Mode

Connect to remote peers by entering their IP address or hostname directly.

Environment Variables

Variable Description Default
PORT Server port 3847
HOST Server host 0.0.0.0
ENVSHARE_DATA_DIR Custom data directory ~/.envshare
ENVSHARE_INSTANCE Instance identifier (for multi-instance) -
OPEN_BROWSER Auto-open browser in dev mode false

License

MIT

About

Secure P2P environment variable sharing for teams. Auto-discover peers on your network, share .env files instantly. No cloud required.

Topics

Resources

Stars

Watchers

Forks

Languages