Offline Applications with Node.JS and CouchDB

I have an application that I would like to create. But I'm not sure how to do this. I use node.js and would like to use couchdb, but if something like mongodb or riak would be a better choice, they will want to hear ideas. But I have a website, say

cool.com

and it has a couchdb instance, as well as a site for managing the repository. let's say in a shopping cart. In db all items and store data are stored. The application itself has an administrator backend to manage this data and can modify elements. What I would like to do is the ability to disconnect the user from the Internet and still have work with the admin backend. I understand that for this I need to use the client-side infrastructure with my models / routes / controllers / independently. But I'm not sure how to allow the site to work offline. couchdb, if installed locally, can synchronize data from local to remote when it is online, and if the admin user is on the computer, I can install it on the couch. but it can be dirty.

Also, what if the admin user is on a tablet or phone? Do I need to have a real mobile app and a desktop app? Is there any way that I can configure this so that it is an end-user without any problems. I would also like this to be disabled for end users, but the large audience is the administrator.

Another use case is installing a POS system. and the power goes out. But the POS system can be downloaded from the Internet to the tablet, and they can still make card-based sales if Wi-Fi is disabled because the application is available offline.

I just don't know how to do this. suggests that I need a client processing engine that can process data, as well as a backend. something like ember, or angular. theres also all in one stack like meteor and js derby, but those arent completely autonomous, but for real-time appearance. although the meteor has a mini-mongo, so it might be worth a look.

I was hoping that someone could help me figure out how I would earn this setting, preferably with a couch, but another nosql would work if I had the opportunity to synchronize the data.

+7
source share
3 answers

There, an interesting project called AppJs ( http://appjs.com/ ), which contains the Node.JS and Chrominium packages as a desktop environment. It is currently very fresh (very small documentation), but it seems straightforward (you will use the same tools as for your online application).

As for the synchronization of the offline and online environment. I doubt you can rely on CouchDB as you expect. CouchDB's mobile support is not as complete as some of the documentation suggests. Thus, in this sense, it would be no different than using SQL / Mongo / Punchcards.

You may be lucky to have developed an appropriate serialization scheme based on XML or JSON (or just plain text) and file transfers between online and offline installations.

Change Starting with this writing, Node Webkit - http://nwjs.io/ is clearly the most obvious replacement for App.js. It has a very simple API and some great features.

+3
source

I'm not sure if this will work for you, but I have been thinking about such an application for a long time and have done some research on what is possible. The best solution I could come up with is to use a server with couchdb and write a client application. Then use pouchdb to store data and regularly synchronize pouchdb with couchdb serveride if the application is connected to the network. I know that the bag is at an early stage, and not ready for production, but if you are ready to do some work in it, I would say that it is doable.

+6
source

If you want clients to work without changes when they go offline and go online (for example, POS with power off), then I would recommend making the application primarily work with local storage with a background edition or synchronization with the cloud.

The local storage parameters can be everything, starting from something bright, like sqlite, sqlexpress, firebird and without any sql parameters, such as mongo, couchdb, etc.

But for the client or device, consider the simplicity of the configuration and the weight of the option. You also need to consider the type of clients β€” do you have many platforms that vary from devices to PCs? You do not want something that has a heavy configuration and runtime. It is good on the service side.

From a service point of view, consider the nature of your data and whether it will improve performance for transactional / relational systems (banking, etc.) or, ultimately, consistent / non-transactional (without sql) documents. Do not forget the hybrid as an option. Also consider a service platform - for example, node goes well with mongodb (json objects from front to back) ...

The storage parameters for devices and services can be different (and probably should be) separated by service interfaces (soap, rest / http, sockets, etc.).

It is difficult to have one size that fits the whole solution, but often something lightweight, such as sqlite on the device or client, simplifies installation / configuration, while scalability on the service side with something like sqlserver / mysql or couchdb / mongodb has the meaning.

Some links to read:

You doubt that it is widely disclosed, and no one is suitable for any solution. I hope I have provided some options for thought.

+4
source

All Articles