Project · Active
envsync
Serverless, end-to-end encrypted syncing of API keys and secrets across the machines on my home LAN.

I work across three machines on my desk: a MacBook Pro for daily work, a Razer laptop for Windows testing, and a Beelink MiniPC that switches between Linux and Windows when I want to run local LLMs. That setup is handy for testing, but keeping environment variables and API keys in sync across all three got annoying quickly.
Whenever I generated an API key on one machine (like a Google Maps API key), I’d eventually need it on another. Most of the time that meant messaging the key to myself on Slack or digging through a password manager to copy-paste it over. I wanted something where adding a key on one machine makes it show up on the others automatically.
So I built env.sync.local — you can check it out and install it from GitHub.
What I wanted it to do
There were a few specific things I needed from this:
- No central server: I didn’t want to run a secrets vault or maintain a master node. If any two machines are on the same network, they should be able to sync directly.
- Minimal setup: On a new machine, running an install script should be enough for it to find the existing machines and start syncing.
- Encrypted at rest: Secrets shouldn’t sit in plaintext on disk, even if the drive itself is encrypted.
Discovery and transport
Home networks don’t usually have static IPs, and I didn’t want to maintain a list of IP addresses in a config file. For discovery, env-sync uses mDNS (Bonjour/Avahi) and registers an _envsync._tcp service on the local network so any machine running the daemon can find its peers.
For moving files, I started with a basic HTTP server, which is still there as a fallback. The default transport is SCP over SSH. Since I already have SSH access set up between my machines, reusing it gives me authentication and encryption in transit without having to build a separate trust layer.
Encryption and adding new machines
The first version just synced plaintext files, which I didn’t want to leave on disk if someone ever got access to one of the machines. I switched to AGE (X25519) for encryption at rest.
Without a central server holding a shared key, you need a way for a new machine to join. env-sync uses a multi-recipient model: each machine generates its own X25519 key pair, and when a new machine joins, it broadcasts its public key. Existing machines pick up the new public key and re-encrypt their secrets to include it as a recipient.
To speed up onboarding, there is also a remote trigger. A new machine can SSH into an existing peer, pass over its public key, and ask that peer to re-encrypt and sync immediately instead of waiting for the next cycle.
Moving from Bash to Go
I wrote the first version as a set of Bash scripts over a weekend. That was quick to get working, but Bash got hard to maintain as the project grew. Managing background daemons, parsing JSON output from mDNS tools, handling paths across macOS, Linux, and WSL2, and debugging shell quoting issues started taking more time than the actual features.
I rewrote the core in Go for a few reasons:
- Single binary: Compiling to a statically linked binary makes it easy to drop onto any machine without worrying about runtime dependencies.
- Native AGE support: Using the
filippo.io/agelibrary directly means I don’t need theageCLI installed on the host. - Concurrency: Goroutines and
selectloops made it easier to run the mDNS listener and periodic sync together without fragile background processes.
Once it is running, it stays in the background. When I add a key on one machine, it usually propagates to the others by the time I switch over and open a terminal.
Technical overview
- Discovery: mDNS via
_envsync._tcpon port 5739 - Transport: SCP/SSH (default) or HTTP (fallback)
- Encryption: AGE (X25519)
- Conflict resolution: Per-key timestamps (latest write wins)
- Distribution: Peer-to-peer gossip-style sync