Self-hosting Local Stash phone sync

Phone sync works out of the box with the default servers. This guide is for people who want no third-party server involved at all.

Phone sync touches up to four servers. You can replace any of them:

Part Default What it sees Replace it when
Phone app: the web page the QR code opens localstash.vercel.app/app/ That your phone loaded the page You want to serve the app yourself
Handshake relay: introduces the two devices ntfy.sh Encrypted messages it can't read, plus your IP address and timing You don't want a public relay
STUN: tells each device its public address stun.l.google.com Your IP address You don't want Google to see your IP (or turn it off entirely)
TURN (optional): relays the encrypted connection when a direct one is blocked none Encrypted traffic it can't read Sync fails on office, school or guest Wi-Fi, or some mobile networks

Your files never pass through the phone-app host, the relay or STUN. If you add TURN, file traffic passes through it, still end-to-end encrypted by WebRTC (DTLS).

After changing anything: Local Stash panel → More → Your own server (advanced), fill in the fields, click Save settings, then scan the new QR code on your phone. The phone picks up every setting from the QR code; there's nothing to configure on the phone itself.


1. Handshake relay: your own ntfy server

ntfy is a small open-source pub/sub server. Local Stash only needs plain publish and subscribe.

docker run -d --name ntfy --restart unless-stopped \
  -p 8080:80 \
  -e NTFY_BASE_URL=https://ntfy.example.com \
  -e NTFY_CACHE_DURATION=0 \
  binwiederhier/ntfy serve

Setting in Local Stash: Handshake relay → https://ntfy.example.com

2. TURN (and STUN) with coturn

One coturn server can provide both STUN and TURN.

docker run -d --name coturn --restart unless-stopped --network host \
  coturn/coturn \
  -n --log-file=stdout \
  --listening-port=3478 \
  --realm=turn.example.com \
  --external-ip=$(curl -s https://ifconfig.me) \
  --lt-cred-mech --user=stash:CHANGE-THIS-PASSWORD \
  --no-cli --no-tlsv1 --no-tlsv1_1 \
  --min-port=49160 --max-port=49200

Settings in Local Stash:

Note: TURN credentials travel inside the QR code so the phone can use them too. Anyone who can see your QR code can also use your TURN server, so treat the code like a password. You can always make a new one with Reset QR code.

3. Phone app: host it yourself

The phone app is a static folder: site/app/ plus site/fonts/. Serve the whole site folder from any static host over HTTPS:

# simplest: any static server behind HTTPS
npx serve site -l 5000
# or copy site/ into nginx/Caddy's web root

Then set Phone app address → https://your-domain.example/app/

Requirements:

4. Fully offline, inside your own network

Everything can run inside your home network:

  1. ntfy and coturn on a home server (e.g. https://stash.home.example)
  2. STUN empty, TURN optional (on one LAN, devices connect directly)
  3. The phone app served from the same home server

No packet leaves your network.

Troubleshooting

Problem Check
Phone stuck on "Waiting for…" The relay URL is reachable from both devices over HTTPS. Open https://ntfy.example.com/v1/health on the phone.
"Could not connect directly" Add a TURN server, or make sure STUN is set. Test with Google's Trickle ICE page: you should see relay candidates for TURN.
Settings changed but nothing happens Scan the new QR code. Old codes keep the old settings.
Want the defaults back More → Your own server → Reset to defaults.