title: Using OneDrive or Dropbox as a database
body: <p>First off, this is not a duplicate of any <a href="https://stackoverflow.com/questions/8968158/using-dropbox-as-a-server-for-my-django-app">of</a> <a href="https://stackoverflow.com/questions/16325370/using-dropbox-as-database">these</a> <a href="https://stackoverflow.com/questions/10944564/dropbox-api-using-dropbox-as-a-server">questions</a>, which discuss using a single Dropbox account as the backend of a multi-user app</p>
  <p>I have built a handful of apps, mostly on Windows Phone and Windows Store, and have lots more in the works.</p>
  <p>I often find myself wanting to add data synching to these apps, between devices but for the same user. My apps are often free or very cheap, and I can't afford to fork out money for a database hosting server. I do have a paid hosting account with some limited DB space I could use, but in the (unlikely) event that one of my apps becomes a runaway success I'm suddenly stuck with a large hosting bill. In that case I'd have to suddenly start charging users a recurring amount for apps that were previously free, or worse, already paid for.</p>
  <p>I keep coming back to this idea of using OneDrive, or Dropbox, or some other free cloud hosting as a database. Here's how I see it working.</p>
  <p>Lets say we have a todo app called <a href="http://en.wiktionary.org/wiki/jobbie#Scots" rel="nofollow noreferrer">Jobbie</a></p>
  <ul>
  <li>User installs Jobbie on both devices</li>
  <li>User logs into OneDrive on both devices, creating a &quot;jobbie&quot; sync folder in their OneDrive folder</li>
  <li>On Device A, User creates a new todo item &quot;pick up dry cleaning&quot;</li>
  <li>Device A uploads a text file to OneDrive with the name &quot;20153001-pick_up_dry_cleaning.item&quot;.</li>
  <li>Device B scans the folder, finds a new file, and adds it to local database</li>
  <li>On Device B, User marks &quot;pick up dry cleaning&quot; as &quot;done&quot;, and the file is renamed to &quot;x20153001-pick_up_dry_cleaning.item&quot; (or deleted)</li>
  <li>Device A scans the folder, sees the item has been renamed (or deleted) and removes it from local database</li>
  </ul>
  <p>The obvious problems I see with this approach are</p>
  <ol>
  <li>items are limited to 255 - 9 characters (9 reserved for xYYYYMMDD), unless you want to download each file which would be quite slow</li>
  <li>there's no locking</li>
  </ol>
  <p>Other than these two issues, are there any other problems I might face implementing such a system?</p>
  <p>PS: I have also considered overwriting a stored SQLite file with a local copy but I figure this would be too much data overhead for a mobile device</p>
  <h1>UPDATE</h1>
  <p>I've accepted Peter Nied's answer below, which pointed out the issues I might encounter with such a system, which answered my question. However, Smarx pointed out in the comments that Dropbox has a free datastore API which I can use for my apps. This seems like a far better solution than trying to implement my own datastore on top of the file system, so I'm going with that.</p>
  <h1>UPDATE 2</h1>
  <p>The Datastore API was deprecated just 3 months after I updated the post, so its no longer available. Luckily I hadn't started developing against it at that point. You can use Dropbox as a standard flat-file storage very easily, but if you want to do any kind of sync you'll have to roll your own</p>
  <h1>UPDATE 3</h1>
  <p><strong>June 2021</strong></p>
  <p>I did build something akin to &quot;Jobbie&quot; for personal use, but I ended up storing data in a text file using the Dropbox API, similar to how Todo.TXT works.</p>
  <p>My Mobile app on Android (VueJs / Cordova) syncs my content changes to Dropbox, and then on any laptop I can open up the txt file in any text editor and make changes if I need to. It works very well for my use case.</p>
  <p>Once or twice I've had the text file open in an editor with autosaving enabled (some markdown editor on Mac) and I have lost data when the latest version was overwritten with an older copy, but using Dropbox revision history it was easy enough to recover data.</p>
  <p>If you're building a lightweight app and need to sync simple data between devices on the cheap, this works.</p>