javascript library for client side storage with server side sync [closed]
Asked Answered
B

9

18

I'm looking for a javascript library that will let me store data in a client side database and in the back ground automatically sync the database back to the server's database

preferable something that supports a variaty of engines in the same way jStore for jQuery does

Looking around I can find anything

Baggage answered 14/3, 2010 at 11:25 Comment(0)
G
5

Just stumbled across this question; for posterity, CouchDB and CouchBase are designed for this:

http://couchdb.apache.org/

The JavaScript client:

https://pouchdb.com/

And CouchBase:

https://www.couchbase.com/

Finally, CouchBase Lite/Mobile:

https://www.couchbase.com/products/lite

The latter gets you native CouchDB/CouchBase synchronization.

In all cases you just access the local database and it can synchronize if and when you connect to the internet.

Gibeonite answered 21/11, 2017 at 21:57 Comment(0)
J
3

Store.js deal with the client-side storage very well. Note that it supports IE6+ along with other browsers. For the server-side storage you might as well make your own script for that as it should not be difficult.

Jeneejenei answered 29/7, 2010 at 7:19 Comment(1)
According to their documentation: "store.js uses localStorage when available, and falls back on the userData behavior in IE6 and IE7". It does not store to Web SQL Database or IndexedDB. Also it does nothing for data synchronization.Murine
S
3

Since this question was asked, there's been a lot of work done on local storage and client side databases.

There's a great overview of local storage options at Dive Into HTML5.

There are also several cross-platform JavaScript storage libraries available, including Lawnchair and persistence.js.

Stidham answered 29/7, 2011 at 14:53 Comment(0)
W
1

Iam not 100% sure, but i think there isnt such a framework. I would recommend to have a look on Google Gears.

Google Gears supports offline storage on client side.

Another approach would be to check out the sourcecode of TidlyWiki. They have created an wiki system wich stores all data on client side.

Walton answered 14/3, 2010 at 12:14 Comment(2)
offline storage isn't so hard as it once was, there are some libraries that support either Gears, HTML5 local DB and flash. the original question is more about the background sync with the server (when online)Pearman
Also, Google Gears is being dropped.Nevanevada
R
1

I'm not aware of any library that does that nowadays. Even tough this is a possible idea, I must say that I'm not sure if making such library is a good effort.

It would have to provide examples of how to expose your server data to the library, how to calculate deltas, and so on. This would force the developer to change this server side code accordingly to the library's protocol. This could be great for new apps and websites, but this could be a pain to any existing site, with particular data structure, making the effort to implement this not so much preferable to developing your own Javascript to do that with current data already exposed by the app. All of these on top of potential security problems would be kinda hard to manage in one generic javascript library.

IMHO this is a great idea to make bundles or plugins to specific ORM based MVC frameworks, for example Ruby on Rails or Django. Since the framework itself has an abstraction to the data structure and many security fixes already bundled together, making a bundle to do that would be much more re-usable and more elegant.

Ruebenrueda answered 28/7, 2010 at 11:33 Comment(0)
B
0

I've been doing some work on this. It seems to be almost possible using Google Documents. Most of the APIs are accessible via Javascript. Unfortunately the exceptions include things like upload and download, so while it's possible to enumerate documents, create files, change metadata etc all from inside the browser, actually getting at the data is a lot harder.

Google Spreadsheets do have Javascript APIs for accessing individual cells, so it's theoretically possible to store your data in a spreadsheet. Unfortunately there's another whole in the API where it seems to be rather hard to write data to a cell that previously did not have data in it, which means that once you've created your empty spreadsheet, you can't populate it...

Bourges answered 28/7, 2010 at 16:52 Comment(0)
Y
0

As far as I know Safari, Chrome, and Opera all based on SQLite. SQLite has a .dump command which is not only great to restore a database but to sync with another database. Therefore, it may be possible to call this from the Javascript Database using .dump, and if necessary, modify the dump and upload it to the server database to execute.

However, you will want to be careful of SQL injection attempts.

Yean answered 14/7, 2011 at 19:22 Comment(2)
Can you access .dump from Javascript?Nyaya
This looks great for local database backup, but this is not usable for CRUD operations (e.g. scalability).Murine
E
0

Did you try jsonengine?

Not sure how much this project is alive but this answers all yor requirments.

Ethno answered 14/6, 2012 at 19:26 Comment(1)
As far as I understood, jsonengine is an implementation of server-side RESTful API. It provides usage examples which either persist data to the server or to the client local storage. However, nothing is done for client-server synchronization.Murine
O
0

Firebase does this, although it is not a relational model

Osman answered 28/11, 2014 at 9:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.