Deploy Syncthing | (Just Updated) Continuous File Synchronization Server, GUI And REST API Locked From Boot

Syncthing file synchronization server with REST API, web GUI and volume

Deploy Syncthing | (Just Updated) Continuous File Synchronization Server, GUI And REST API Locked From Boot

Just deployed

/var/syncthing

Deploy and Host Syncthing on Railway

Built for an LLM agent to deploy and use. The deploy form has nothing to fill in: the web GUI login and the REST API key are generated, the GUI is locked behind a login from the first boot, and the device identity, configuration and synced files survive redeploys on a volume. Syncthing is open-source continuous file synchronization between devices, with a web GUI and a REST API.

About Hosting Syncthing

This template runs one service from the upstream Syncthing image (version 2.1.7), pinned by digest. Everything Syncthing keeps (device key and certificate, configuration, index database and the default Sync folder) lives on one volume mounted at /var/syncthing. Railway mounts a volume owned by root while Syncthing runs as an unprivileged user, so the start command fixes the ownership of the volume first.

No open GUI. A stock Syncthing starts with no GUI login, which on a public domain would hand the whole instance to the first visitor. The start command sets the GUI login (user admin) from the generated SYNCTHING_GUI_PASSWORD on every boot, and fixes the REST API key to the generated SYNCTHING_API_KEY, so both stay the same across redeploys. There is no account registration in Syncthing: the one login is the one generated for you.

What the template fixes for Railway. The web GUI and REST API listen on Railway's injected PORT, which is also the port the healthcheck dials.

Connecting other devices. The sync listener (port 22000) is not published, because Railway cannot share one service between an HTTP healthcheck and a TCP proxy. This instance reaches your other devices outbound through Syncthing's global discovery and public relays; add the device ID shown in the GUI on the other side. Direct inbound connections to this service are not available.

Using it. Open the service domain, sign in as admin with SYNCTHING_GUI_PASSWORD (read it from the syncthing service variables), then add devices and folders. For an agent, use the REST API with the API key as in the contract below.

Agent contract

  • Public URL: SYNCTHING_PUBLIC_URL on the syncthing service (the generated https address of the service)
  • Private URL: http://syncthing.railway.internal:8080
  • Credentials: the variables SYNCTHING_API_KEY (REST API) and SYNCTHING_GUI_PASSWORD (web GUI, user admin) on the syncthing service
  • Auth: REST calls send the header X-API-Key with the value of SYNCTHING_API_KEY; HTTP Basic is not accepted on /rest. The web GUI signs in with POST /rest/noauth/auth/password and a JSON body holding username admin and password from SYNCTHING_GUI_PASSWORD, which answers 204 and sets a session cookie; a wrong login answers 403. A request with no key or a wrong one answers 403, so write without key: 403.
  • Health: GET /rest/noauth/health returns 200
#!/bin/sh
# needs: SYNCTHING_PUBLIC_URL, SYNCTHING_API_KEY, SYNCTHING_GUI_PASSWORD (variables of the syncthing service); also curl
# signup: none - Syncthing has no account registration; the one GUI login is generated at boot, so there is nothing to sign up to
R="$SYNCTHING_PUBLIC_URL"; K="X-API-Key: $SYNCTHING_API_KEY"; J="Content-Type: application/json"
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/rest/noauth/health")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/rest/noauth/health"
curl -s -H "$K" "$R/rest/system/status" | grep -c '"myID"' | sed 's/^/status with key (1 = device id returned): /'
# write with the key: add a folder, read it back, remove it
curl -s -o /dev/null -w "create folder: %{http_code}\n" -H "$K" -H "$J" -d '{"id":"railway-check","label":"railway-check","path":"/var/syncthing/railway-check","type":"sendreceive"}' "$R/rest/config/folders"
curl -s -H "$K" "$R/rest/config/folders/railway-check" | grep -c '"id": "railway-check"' | sed 's/^/folder found after write: /'
curl -s -o /dev/null -w "delete folder: %{http_code}\n" -X DELETE -H "$K" "$R/rest/config/folders/railway-check"
# the web GUI login (user admin) answers with a session cookie
curl -s -o /dev/null -w "gui login: %{http_code}\n" -H "$J" -d "{\"username\":\"admin\",\"password\":\"$SYNCTHING_GUI_PASSWORD\"}" "$R/rest/noauth/auth/password"
curl -s -o /dev/null -w "gui login wrong password: %{http_code}\n" -H "$J" -d '{"username":"admin","password":"wrong"}' "$R/rest/noauth/auth/password"
curl -s -o /dev/null -w "read without key: %{http_code}\n" "$R/rest/system/status"
curl -s -o /dev/null -w "write without key: %{http_code}\n" -H "$J" -d '{"id":"anonymous","path":"/tmp/anonymous"}' "$R/rest/config/folders"
curl -s -o /dev/null -w "write wrong key: %{http_code}\n" -H "X-API-Key: wrong" -H "$J" -d '{"id":"anonymous","path":"/tmp/anonymous"}' "$R/rest/config/folders"

A fresh deploy prints health: 200, status with key (1 = device id returned): 1, create folder: 200, folder found after write: 1, delete folder: 200 and gui login: 204. The refusals print gui login wrong password: 403, read without key: 403, write without key: 403 and write wrong key: 403: a request with no key or a wrong one creates nothing.

Why Deploy Syncthing on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Syncthing on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

  • Agent-ready - generated GUI login and API key, a contract block and one script that proves the REST API, folder create, read and delete, the GUI login, and the refusal of a read and a write with no key or a wrong one.
  • No open GUI - the login is set at boot, so the first visitor gets nothing.
  • Data survives redeploys - device identity, configuration and files sit on a volume, with the right ownership set at boot.
  • Always-on peer - an always-online device other devices can sync through.
  • Pinned - the upstream image is pinned by digest.

Common Use Cases

  • Always-on sync hub - keep one online copy so laptops and phones sync even when they are never on at the same time.
  • Off-site backup target - mirror a folder from a home machine to a copy kept elsewhere.
  • Self-hosted Dropbox alternative - sync folders across your devices with no third-party storage.
  • File exchange for AI agents - an agent drives folders and devices over the REST API.

Dependencies for Syncthing Hosting

  • The one syncthing service created by the template with its /var/syncthing volume. Nothing else is required.

Deployment Dependencies


Template Content

More templates in this category

View Template
RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set
S3-compatible object store, keys and public URL preset, volume kept

SuperSlowSloth
0
View Template
TimescaleDB
A PostgreSQL-based time-series database for analytics on Railway.

Rakit
1
View Template
NEW
Neo4j 2026.10 Community
Neo4j graph database with APOC, Browser, Bolt TCP proxy and a volume

My Projects
0