I have a requirement to build ROR + MongoDB offline app to run as desktop application. I have never used electron before, is it possible to bundle it in a desktop application and also will it run in a machine where ROR and mongo is not even installed?
So my requirement is to build a CRUD desktop app which will save data in some database may be sqllite or mongodb. For now I have built a TODO app which saves data in localstorage, but in my case I need actual database. So is it possible to do it with electron?
Yes, it is possible. There are a number of database interface libraries available for Node.
So if suppose I want to go with mogodb, does it mean that the clients machine should be pre installed with mongodb? Or can I package mongodb with the installer file?
That part you’ll probably have to figure out on your own. I have no experience with MongoDB, how to install or package it.
MongoDB is quite large to be distributing with your app, which will already be around 175BM. If that is not a concern, you would then have to write a script (which would be platform dependent) to install, configure, and fire up the mongo server for you. Then you can either leave the server running on the user’s computer, or shut it down when the user shuts down the app; again this would use a platform dependent script.
If you want a PoC, it is likely easiest to use one of the embedded JS dbs that mimic the Mongo APIs. One is NeDB, but it is restricted to a single document per database instance. Another is TingoDB which allows the use of Mongoose at the data access layer if you are accustomed to using that sort of thing. TingoDB supports BSON, so you can more easily migrate your data by importing into Mongo. TingoDB has an issue with Windows that we are looking into solving for our offline project.