One SQLite file that survives iCloud, Dropbox, and Syncthing conflicts
Put an ordinary SQLite database inside iCloud Drive, Dropbox, or Syncthing and edit it on two devices, and one device's edits disappear into a conflicted copy. Here is how BaseStudio's .basestudio format makes a single SQLite file merge safely record by record without running a sync server.
Every developer who builds a local-first desktop app hits the same wall with SQLite. SQLite is a single binary file — fast, durable, inspectable with sqlite3, and ideal when a user does not want 10,000 loose Markdown files cluttering a folder.
The problem starts the moment a user puts that .sqlite file in iCloud Drive, Dropbox, Obsidian Sync, or Syncthing.
Why ordinary SQLite breaks under file sync
File-sync services do not understand SQLite pages, B-trees, or write-ahead logs (-wal / -shm). Two failure modes show up immediately:
- Silent overwrite or conflicted copies: You check off a task on your laptop on a plane and add a note on your phone. When both reconnect, the sync service sees two different binary files. Either the newer file overwrites the older one, or the service creates
Tasks (conflicted copy).basestudio/Tasks.sync-conflict-20261201.basestudio— leaving the user to figure out which rows diverged. - Whole-file upload churn on every keystroke: Writing directly to a 15 MB SQLite file on every edit forces the sync client to re-upload the entire file every few seconds and multiplies the window for overlapping writes.
Most apps respond by abandoning file sync altogether and requiring a proprietary cloud server or a Docker PostgreSQL container. BaseStudio takes a different path: keep one open SQLite 3 file, never require an account or sync server, and design the file format so file-sync conflicts merge deterministically.
Three pieces that make single-file sync safe
1. Small append-only .bschanges sidecar files
When BaseStudio (the desktop app, the Obsidian plugin, or the basestudio CLI) edits a .basestudio database, it does not rewrite the main SQLite file on every keystroke. Instead, each active writer session writes small, structured change entries into its own sidecar file beside the database:
Tasks.basestudio # the main SQLite 3 databaseTasks.3f9a1c2e.desktop-9c1e.k2p8.bschanges # pending changes from one writer sessionNotice two practical details in that filename:
- Every writer session owns a unique filename (
<db-id>.<writer>.<session>.bschanges). Two devices — or the desktop app and Obsidian running side by side on the same Mac — never race to write the same sidecar file. - No leading dot. Obsidian Sync skips hidden dot-files by default, so sidecar files stay visible to sync engines while Obsidian’s file explorer and macOS Finder hide them from everyday clutter.
Thirty seconds after the last edit (sooner after large batches, or immediately on close), a writer folds all pending .bschanges files into Tasks.basestudio and removes the sidecars whose changes are now inside the database. Most of the time on disk, only the single .basestudio file exists.
2. Hybrid logical clocks and per-field LWW registers
To merge edits from multiple devices without a central server, every device needs a total, deterministic order for field changes — even when two machines’ system clocks drift slightly.
BaseStudio stamps each change entry with a Hybrid Logical Clock (HLC) formatted as a plain sortable string:
<13-digit wall time in ms>-<4-digit counter>-<writer.session>1796123456789-0000-desktop-9c1e.k2p8Two clock values compare in time order with ordinary string comparison, and because <writer.session> is unique per session, ties never happen. Remote clocks more than 24 hours ahead of local time are rejected so a misconfigured clock cannot freeze future edits.
Inside Tasks.basestudio, the registers table tracks the latest HLC value for each field of each record:
- If Device A changes
statustoDoneand Device B changesprioritytoHighon the same record, both fields have separate registers — so both edits survive. - If both devices edit the exact same field (
status), the higher HLC wins deterministically on every device, and the overwritten value is preserved inrecord_versionsso nothing is silently lost.
3. Automatic recovery from sync-service conflict copies
What if two devices were both offline long enough to fold into Tasks.basestudio separately, and Dropbox, iCloud, or Syncthing creates a conflict file like Tasks (conflicted copy).basestudio or Tasks.sync-conflict-….basestudio?
Because every .basestudio file carries its full registers table (plus records, bases, and attachments), BaseStudio detects conflict copies beside the open database, merges their registers, records, and versions into the primary database record by record, and moves the conflict copy to the trash.
Still readable by plain sqlite3
None of this hides your data behind a binary blob format. Every .basestudio file is standard SQLite 3 (STRICT tables, PRAGMA application_id = 0x42534442) with a notes view and a built-in meta row (key = 'format') that documents the schema inside the file itself:
sqlite3 -header -column ~/Documents/Tasks.basestudio \ "SELECT path, json_extract(properties, '$.status') AS status, updated_at FROM notes ORDER BY updated_at DESC LIMIT 5;"One important rule for external tools: read freely with sqlite3, but write through the BaseStudio app, plugin, or basestudio CLI. Because multi-device merges rely on registers and .bschanges, a raw SQL UPDATE bypasses the register clock and will be overwritten on the next fold.
Honest tradeoffs
- Attachment size matters with file sync. Because attachments live inside the
.basestudiofile, adding dozens of large raw images increases the size uploaded whenever the database folds. BaseStudio’s built-in image optimizer (lossy WebP capped at 2560 px, with undoable originals) keeps databases compact. - Not a real-time multiplayer team engine. This architecture is built for one person working across their own laptop, desktop, phone (via Obsidian), and local AI agents — not ten people typing in the same cell simultaneously.
If you want to inspect the exact tables inside a .basestudio file yourself, read Read your data without BaseStudio.
Try BaseStudio on your own files — or in the browser first.
Free forever for Bases up to 30 records, with no account and plain Markdown or SQLite files on your disk.