Self-hosting · Android · 2025–26
SyncFlow
Folder sync between an Android phone and my own servers, without a vendor app or cloud in the middle.
Problem
Photos and documents on my phone needed to land on storage I run. The apps I tried each spoke one protocol, wanted their own cloud account, or synced on a schedule the operating system quietly cancelled.
Constraints
- Android, not the app, decides when background work runs: Doze, standby buckets and foreground-service rules all apply.
- Scoped storage. Folders come from the system picker, not from raw paths.
- Two-way sync must never turn a missing file into a delete without evidence that it was really deleted.
- Server credentials stay encrypted on the device, behind an optional biometric lock.
What I built
A native Kotlin and Compose app that pairs a local folder with a remote one: upload-only, download-only or two-way, with mirror, keep or archive handling for deletes and six conflict strategies.
Providers for WebDAV, Nextcloud (with chunked uploads for large files), ownCloud and SFTP with trust-on-first-use host keys. Google Drive, Dropbox and OneDrive are written but not yet enabled in release builds.
Periodic, manual and on-change triggers, with a Room database tracking per-file state, conflicts and an event log so every decision can be explained after the fact.
Result
- About 8,800 lines of Kotlin, running on my own phone.
- 62 unit tests, concentrated where mistakes cost data: the sync decision table, exclusions and path safety.
Next
- Apply one scope rule to both the local and remote walks. A review found they can disagree for non-recursive pairs, and the engine should never have to guess.
- A calmer home screen that leads with status (last sync, file count, next run) and a step-by-step setup in place of one long form.