π Bidirectional sync for Obsidian vaults on headless Linux servers
Sync your Obsidian vault to a headless Linux server (VPS, Raspberry Pi, home server) using the official Self-hosted LiveSync protocol.
Perfect for:
- β Server-side automation and scripting
- β Backup solutions
- β CI/CD workflows
- β Headless note processing
- β Multi-device sync via intermediate server
- β Full LiveSync compatibility - Works with the official Obsidian LiveSync plugin
- β Bidirectional sync - Upload and download changes automatically
- β E2EE support - Optional end-to-end encryption (HKDF + AES-256-GCM)
- β Change detection - Efficient mtime + size tracking
- β Systemd integration - Runs as a background service
- β Easy setup - Interactive configuration wizard
- β No desktop required - Pure Node.js, runs anywhere
git clone https://github.com/tgmstudios/obsidian-livesync-headless.git
cd obsidian-livesync-headless
npm installnpm run setupThe setup wizard will ask for:
- Vault path (e.g.,
/home/user/obsidian/my-vault) - CouchDB URL (e.g.,
https://obsidian.example.com) - Database name
- Username and password
- E2EE settings (on/off + passphrase)
One-time sync:
npm startInstall as systemd service (recommended):
npm run install-service
sudo systemctl enable obsidian-sync
sudo systemctl start obsidian-sync- Node.js 18+
- CouchDB server with LiveSync database
- Linux (systemd for service mode)
After running npm run setup, config is saved to config.json:
{
"vaultPath": "/home/user/obsidian/vault",
"couchDB": {
"uri": "https://obsidian.example.com",
"database": "obsidian-vault",
"username": "admin",
"password": "secret"
},
"e2ee": {
"enabled": false,
"passphrase": ""
},
"syncIntervalSeconds": 30
}Important: Keep config.json secure! It contains your CouchDB credentials.
sudo systemctl status obsidian-syncjournalctl -u obsidian-sync -fsudo systemctl restart obsidian-syncsudo systemctl stop obsidian-syncThis tool implements the same sync protocol as the official Obsidian LiveSync plugin:
-
Document Structure
- File metadata stored with
_id= filename - Content split into chunks (type:
leaf) - Chunks referenced in
childrenarray
- File metadata stored with
-
Sync Process
- Every 30 seconds (configurable):
- Upload local changes first (preserves edits)
- Download remote changes second
- Uses PouchDB changes feed for efficient sync
- Every 30 seconds (configurable):
-
Encryption (Optional)
- HKDF-SHA256 key derivation (310,000 PBKDF2 iterations)
- AES-256-GCM encryption
- Ephemeral salts (same as LiveSync plugin)
| Feature | Official Plugin | This Tool |
|---|---|---|
| Platform | Obsidian desktop/mobile | Headless Linux |
| Sync Protocol | β LiveSync | β LiveSync (compatible) |
| E2EE | β Yes | β Yes (optional) |
| Automation | β No | β Yes (CLI + service) |
| GUI | β Yes | β No (headless) |
- Check service status:
systemctl status obsidian-sync - Check logs:
journalctl -u obsidian-sync -f - Verify CouchDB credentials
- Ensure E2EE settings match your other devices
If you see encrypted chunks but can't read them:
- Your passphrase doesn't match
- E2EE is enabled on one side but not the other
Fix: Update config.json to match your LiveSync settings, then restart.
The service runs as your user. Ensure the vault path is readable/writable:
ls -la ~/obsidian/vaultnode src/sync.mjs --daemonnpm testnpm run docs-
Credentials:
config.jsoncontains your CouchDB password in plain text. Protect it:chmod 600 config.json
-
E2EE: If you enable E2EE, your passphrase is stored in
config.json. Consider using environment variables:E2EE_PASSPHRASE=your-secret npm start
-
CouchDB: Use HTTPS for your CouchDB server. Never sync over plain HTTP.
-
Firewall: Restrict CouchDB access to trusted IPs only.
Contributions welcome! Please:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE for details.
- Obsidian LiveSync by vrtmrz - The original plugin this tool is compatible with
- PouchDB - JavaScript database for sync
- Obsidian - The knowledge base app
- π Bug reports: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Email: aiden.johnson@tgmstudios.net
Made with β€οΈ for the Obsidian community