Docs menuSync with Turso

// docs · sync and data

Sync with Turso

Connect your own Turso (libSQL) database, choose merge or replace, read the sync status and resolve conflicts.

Sync is optional. Snipstack always saves to the library on your device first, then syncs in the background with a Turso database that you own. Any libSQL server reachable over HTTPS works, including one you host yourself. There is no Snipstack account and no Snipstack server in between.

1. Create a database and a token

With the Turso CLI:

turso auth login
turso db create snipstack
turso db show snipstack --url
turso db tokens create snipstack

The third command prints the database URL (libsql://…), the fourth an auth token. The connect form in Snipstack lists the same four commands, each with a copy button, under Don’t have a database yet?. You can also create the database and a token in the Turso web dashboard.

Treat the token like a password: anyone with the URL and the token can read and change your library.

2. Connect

Choose Connect Turso in the welcome wizard, or Settings > Sync (palette: Connect a database…).

  1. Paste the Database URL, for example libsql://my-db-org.turso.io.
  2. Paste the Auth token in its own field, not in the URL.
  3. Click Test connection. Snipstack shows Connected, the response time, and whether the database is empty or already holds a Snipstack library (with its snippet count).
  4. Click Continue. It only works for the URL and token that passed the test.

The URL must start with libsql://, https:// or wss://. Plain http:// and ws:// are accepted only for localhost, 127.0.0.1 and [::1]. It cannot contain a ?query, a #fragment or a user name and password.

Merge or replace

If both the database and this device already hold snippets, Snipstack asks (Existing data found):

  • Merge with this device (recommended): combines both libraries. Snippets that exist on both sides are matched; where both changed, the other version is kept as a copy.
  • Replace this device’s data: uses the database’s library on this device instead. Changes on this device that were not synced yet are discarded, and items that exist only on this device move to the Trash. Snipstack first saves a backup of this device’s library (see Data and backups) and needs you to tick I understand this device’s library will be replaced. If the backup cannot be written, nothing is replaced.

If only one side has data, Snipstack merges without asking.

Then the first sync runs in the background (“Database connected. The first sync is running.”). You can keep working meanwhile.

Where the token is kept

The token is encrypted with your operating system’s secure storage (Keychain on macOS, DPAPI on Windows, libsecret on Linux) and saved on this device only. It is never shown again, never written to the database or the settings, and never logged.

If the system offers no secure storage, Snipstack refuses to set up sync and keeps working locally.

What is synced

Folders, snippets, fragments, tags, variables (including their remembered values) and usage counts (how often and when each snippet was copied, per device). Settings are never synced: each device keeps its own.

The connection is encrypted (TLS). The snippets themselves are stored in your database as you wrote them, so anyone who can read the database can read them.

When sync runs

  • When Snipstack starts, every 60 seconds, and about 2 seconds after you change something.
  • After a failure it retries after 5 seconds, then waits twice as long each time, up to 5 minutes.
  • While your computer is offline it pauses and your changes wait on the device. Sync now (Cmd+Shift+S or Ctrl+Shift+S) tries at once.

Sync status

The badge in the sidebar shows:

Badge Meaning
Synced All changes synced
Syncing Exchanging changes with the database
Offline Changes are saved locally and sync when you are back online
Sync error The last sync failed. Local changes are safe
Local only Not connected: snippets live on this device

Click the badge for details: last sync, what was pushed and pulled, the next retry, and Retry, Reconnect or Copy details when something went wrong. The tray menu shows the same status in words.

Settings > Sync shows the database, the last sync and the number of snippets on this device, with Sync now and Disconnect.

Conflicts

If the same snippet changed on two devices, the most recent edit wins and the other version is kept as a conflict copy, in both directions. The snippet shows a banner, such as “This snippet was also edited on another device; your version was kept as a copy.”

Review them with the palette action Review sync conflicts…, from Settings > Data, or from the sync popover. For each conflict, choose Keep this device’s version or Keep the other version; the one you do not keep is discarded.

If the other device’s clock was more than a day ahead, the review says so: that version keeps winning until the time it shows.

Disconnecting

Settings > Sync > Disconnect stops syncing. Your snippets stay on this device and the encrypted token is deleted from this device. Nothing in the database is changed or deleted; to remove the data, delete the database (and revoke the token) in Turso.

Errors

Message What to do
The database rejected the token. Create a new token and Reconnect.
Could not reach the database. Check your connection and the URL. Check your network. During background sync this shows as Offline.
This database was set up by a newer Snipstack. Update Snipstack to sync with it. Update Snipstack on this device. Sync stops until you sync manually.
That database URL is not valid. Reconnect with a correct URL.
The database reported an error. The details box shows REMOTE: and the server’s message.
Something went wrong while syncing. Retry; the details box has the error. Copy details puts it on the clipboard.
Snipstack could not read the saved database token on this device. Reconnect to resume syncing. Reconnect with the URL and a token.

Reconnect asks for the URL and a new token; your snippets on this device are untouched. For more, see Troubleshooting.