Can I use any other database than Couchdb?

For webapp, Can I configure it to use any other databases than Couchdb ? If yes, how do I configure it ?

1 Like

The codebase heavily relies on the CouchDB API so it wouldn’t be possible to configure it to use another API. There are other implementations of the CouchDB API but these not recommended for use in production environments. So no, it is not possible to configure the CHT to use a database other than CouchDB.

Furthermore it would be very difficult to provide offline first functionality in the browser with any other database, which is discussed more in this blog post.

We support migrating data from CouchDB to Postgres using the couch2pg service to allow easier and quicker querying.

2 Likes

Have you ever considered switching from CouchDB to MongoDB + Realm? Mongo aqcuired Realm last year and have been working on a roadmap to release features that can really help with your use case.

Features include: Offline First Applications, Two Way Sync, Automated Conflict Resolutions, Background Sync, API Management.

It might be interesting to take a look and experiment. It might offer a cleaner solutions to what you are trying to achieve.

PS: Zola Electric in Tanzania used the same technology to handle Offline First applications for their Direct Sales/Door to Door team.

1 Like

MongoDB and CouchDB have very similar feature sets, including the ones you listed. Why do you think Mongo would offer a “cleaner solution”?

1 Like

How can i connect to pgsql, and find out the forms data

Arun

Hi @sahaniarun , welcome to the forum!

pgsql isn’t included in the CHT out of the box but you can set up your own postgres and configure a service to replicate the data into it. At Medic we use couch2pg to replicate the data from CouchDB to Postgres for use in analytical dashboards. There’s some documentation about this on Data Flows for Analytics | Community Health Toolkit

Hope this helps!