Skip to main content

How to Self-Host Syncthing: Peer-to-Peer File Sync 2026

·OSSAlt Team
syncthingfile-syncbackupself-hostingdocker2026

TL;DR

Syncthing (MPL 2.0, ~63K GitHub stars, Go) is a peer-to-peer file synchronization tool — files sync directly between your devices with no central server required. It's like Dropbox but without the cloud: each device keeps a full copy, changes sync in both directions, and everything is encrypted in transit. Use it to sync your documents between laptop and desktop, backup your phone photos to a home server, or keep config files in sync across servers. Dropbox charges $9.99/month for 2TB; Syncthing is free.

Key Takeaways

  • Syncthing: MPL 2.0, ~63K stars — P2P file sync, no cloud, end-to-end encrypted
  • No central server: Devices sync directly — no cloud storage needed
  • Full copies everywhere: Every device has a complete copy of the shared folder
  • Conflict resolution: Handles simultaneous edits with conflict files
  • iOS/Android: Official apps for mobile devices
  • Relay network: Falls back to relay servers when direct connection isn't possible

Syncthing vs Dropbox vs Nextcloud

FeatureSyncthingDropbox FreeNextcloud
LicenseMPL 2.0ProprietaryAGPL 3.0
CostFreeFree (2GB) / $9.99/moFree (hosting)
ArchitectureP2P (no server)Centralized cloudCentralized (self-hosted)
Storage limitDisk size2GB / 2TBDisk size
Mobile backupYesYesYes
File versioningYes (configurable)YesYes
Web UIYes (local)YesYes
Selective syncYesYesYes
End-to-end encryptionYesNoOptional
Share with othersBetween devicesYesYes

Part 1: Docker Setup (Server/Always-On Node)

Run Syncthing on a server as an always-on sync hub:

# docker-compose.yml
services:
  syncthing:
    image: syncthing/syncthing:latest
    container_name: syncthing
    restart: unless-stopped
    hostname: my-syncthing
    ports:
      - "8384:8384"    # Web UI
      - "22000:22000"  # Protocol communication (TCP + UDP)
      - "21027:21027/udp"  # Local discovery
    volumes:
      - syncthing_config:/var/syncthing
      - /path/to/sync:/data    # Synced folder
    environment:
      PUID: 1000
      PGID: 1000
      TZ: America/Los_Angeles

volumes:
  syncthing_config:
docker compose up -d

Visit http://your-server:8384.


Part 2: HTTPS with Caddy

sync.yourdomain.com {
    basicauth {
        admin $2a$14$hash_here    # caddy hash-password
    }
    reverse_proxy localhost:8384
}

Or set a username/password directly in the Syncthing web UI: Actions → Settings → GUI.


Part 3: Desktop Installation

macOS / Windows / Linux

  1. Download from syncthing.net/downloads
  2. Run — a tray icon appears
  3. Web UI opens at http://localhost:8384

macOS with Homebrew:

brew install syncthing
brew services start syncthing

Linux:

# Add repo and install:
sudo apt install syncthing

# Start as user service:
systemctl --user enable syncthing
systemctl --user start syncthing

Part 4: Pair Devices

Syncthing uses Device IDs (like MFZWI3D-BOZGW26-YMWUJ3I-...) for pairing.

On Device A (your server):

  1. Web UI → Actions → Show ID
  2. Copy the Device ID

On Device B (your laptop):

  1. Web UI → Add Remote Device
  2. Paste Device A's ID
  3. Set a name: My Server

Repeat in reverse — both devices must add each other.


Part 5: Sharing Folders

After devices are paired:

On Device A:

  1. Add Folder
  2. Folder path: /data/documents
  3. Folder label: Documents
  4. Sharing tab → enable sharing with Device B
  5. Save

On Device B:

  1. A notification appears: "Device A wants to share folder 'Documents'"
  2. Accept → choose local path (e.g., ~/Documents/Synced/)
  3. Sync begins immediately

Part 6: Folder Types

TypeBehavior
Send & ReceiveFull bidirectional sync (default)
Send OnlyChanges go out but don't come in — good for archive/backup source
Receive OnlyOnly receives changes — good for backup destination

Use Receive Only on your server to create a one-way backup:

  • Laptop: Send & Receive
  • Server: Receive Only

Now the server mirrors the laptop but can't send changes back.


Part 7: Mobile Apps

Android

  1. Install Syncthing-Fork from F-Droid (recommended) or Syncthing from Play Store
  2. Open → Device ID → copy
  3. Add on your server's web UI → paste ID
  4. Create/accept a shared folder

Auto-sync phone photos:

  1. Add Folder: /storage/emulated/0/DCIM/Camera
  2. Share with your server
  3. Server receives all new photos automatically

iOS

  1. Install Möbius Sync (iOS Syncthing client, ~$3)
  2. Or use Syncthing for iOS via TestFlight

Part 8: Versioning (File History)

Keep old versions of changed/deleted files:

  1. Edit Folder → File Versioning
  2. Versioning types:
    • None: No versioning (default)
    • Trash Can: Deleted files move to .stversions/ — like a local trash
    • Simple: Keep N versions per file
    • Staggered: More versions for recent changes, fewer for old ones
    • External: Run a script when a file is versioned
Staggered example:
  Files changed today: keep all versions
  Files changed this week: keep 1/day
  Files changed this month: keep 1/week
  Files older: keep 1/month

Part 9: Ignore Patterns

Don't sync certain files:

# .stignore (place in the folder being synced)
# Syntax similar to .gitignore

*.tmp
*.log
.DS_Store
Thumbs.db
node_modules/
.git/

The .stignore file itself syncs across devices so all devices use the same rules.


Part 10: Relay Servers

When devices can't connect directly (NAT/firewall), Syncthing uses relay servers as a fallback. The data is still encrypted end-to-end — relays only forward encrypted traffic.

To configure your own relay (for privacy or performance):

# Relay server (separate container):
services:
  syncthing-relay:
    image: syncthing/relaysrv:latest
    restart: unless-stopped
    ports:
      - "22067:22067"
      - "22070:22070"

In Syncthing settings, add your relay URL.


Maintenance

# Update Syncthing:
docker compose pull
docker compose up -d

# Logs:
docker compose logs -f syncthing

# Check sync status via API:
curl http://localhost:8384/rest/db/status?folder=FOLDER_ID \
  -H "X-API-Key: $(cat ~/.config/syncthing/config.xml | grep -o 'apikey>[^<]*' | cut -d'>' -f2)"

# Backup config:
tar -czf syncthing-config-$(date +%Y%m%d).tar.gz \
  $(docker volume inspect syncthing_syncthing_config --format '{{.Mountpoint}}')

See all open source file sync and backup tools at OSSAlt.com/categories/storage.

Comments