Deploy xnet-hub
Deploy an xnet.fyi hub server for always online sync and backup
xNet
Just deployed
Deploy and Host xnet-hub on Railway
xnet-hub is the sync server for xNet, a local-first, CRDT-backed workspace. One Node.js binary provides WebSocket sync relay, WebRTC signaling, encrypted backup, file storage, full-text search, and federation for xNet clients. Your devices work offline and merge changes conflict-free; the hub keeps them in sync and backed up.
About Hosting xnet-hub
xnet-hub runs as a single Node.js server with SQLite storage — no external database required. The Docker image builds from the xNet monorepo, compiles native SQLite bindings, and starts the hub via its CLI. Attach a Railway volume at /data for persistent storage, and Railway's $PORT is passed straight to the server. A /health endpoint (which also serves the hub's DID) powers Railway health checks, with automatic restarts on failure. Roles are config presets on the same binary: run it as a personal hub, a team relay, or a demo hub with quotas and periodic eviction. Optional Litestream support streams SQLite replicas to S3-compatible storage.
Common Use Cases
- Personal always-on sync and backup node, so your xNet workspaces stay in sync across desktop, web, and mobile even when your other devices are offline
- Team or community hub relaying real-time collaborative edits (Yjs CRDTs), presence, and file attachments between members
- Self-hosted alternative to the managed xNet cloud — own your data end to end, including full-text search over your own backups
Dependencies for xnet-hub Hosting
- A Railway volume mounted at
/data(SQLite database and file blobs live there; without it, data is lost on redeploy) - Nothing else — SQLite is embedded, so no separate database service is needed
Deployment Dependencies
- xNet on GitHub — source for the hub and the monorepo Dockerfile
- xNet — the app that connects to this hub
- Litestream — optional continuous SQLite replication to S3-compatible storage
Implementation Details
The container reads Railway's $PORT and stores everything under the mounted volume:
node packages/hub/dist/cli.js --port $PORT --data /data
Useful environment variables:
HUB_PUBLIC_URL— the publicwss://URL of your deployment; required for share links to mint correctlyHUB_ROLE— role preset (personal,demo, …); a role is pure config, never a code branchLITESTREAM=1plus S3 credentials — enable streaming SQLite backups
Health checks hit GET /health, which returns status and the hub's DID.
Why Deploy xnet-hub 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 xnet-hub 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.
Template Content
xNet
crs48/xNet