2
votes

Is it possible to have multiple local PouchDB instances on different devices sync with each other when there is no internet connectivity, say within an intranet?

If this is possible, I assume each device would need to have its database accessible via a URL that can be pointed to in code as per the PouchDB Replication docs?

A follow-up question would be can all devices then sync to a remote CouchDB instance when internet becomes available?

2
You must have a server, with network connectivity. Whether that is over the "Internet" or not, is unimportant. - Flimzy
Thanks @Flimzy, I'll consider the approach of having a local server that all devices can sync to, and the server itself syncs to the cloud. - Dominic Surrao

2 Answers

1
votes

I regularly replicate between virtual hosts in a single server and also with a CouchDB in the cloud.

As long as you can HTTP the database you're good to go.

0
votes

You can sync two local PouchDBs if they are on the same device.

If they are on different devices you need some kind of server to establish the connection between them. This could be a local CouchDB or a PouchServer.

I don't know your use case but if you make something like an Electron app you can run a PouchServer within it. This would allow you to sync local devices.

This works on all devices that can run nodejs. We even got it to work ir a Cordava app but it was not production stable so we gave offline syncing up for now.