Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What database to use for my Electron offline Application [closed]

I'm about to choose a suitable local database for my offline ElectronJS application. The Desktop App must add/update/delete/retrieve data from JSON files locally. the database structure is as follows :

{
  'data':[
    {
      'day':1344546000,
      'transactions':[
         {'time':'blabla', 'value1':'100',...},
         {'time':'blabla', 'value1':'100',...},
         {'time':'blabla', 'value1':'100',...},
      ]
    },
    {
      'day':1344546000,
      'transactions':[
         {'time':'blabla', 'value1':'100',...},
         {'time':'blabla', 'value1':'100',...},
         {'time':'blabla', 'value1':'100',...},
      ]
    },
    ....

  ]
}

This data must be placed locally in json file/files, so if the user closed the app and open it again the data should be retrieved.

each day object will have less than 500 transactions a day

like image 781
Georgi Antonov Avatar asked Dec 06 '16 15:12

Georgi Antonov


People also ask

What database should I use for Electron app?

NEDB is a mongo API compatible, file-based database. It's a great fit for electron apps. In this post, I'll walk through my NEDB setup. It's fairly simple and is being used in production at HTTPSLocalhost app.

Can Electron app work offline?

Absolutely. Just like a webpage can be offline .... it's all local files that make your app. Esp, for Electron, you are building a 'desktop app' that doesn't necessarily require anything external, although it can be a 'web app' of course.

Where does an Electron app store data?

The data is saved in a JSON file named config. json in app. getPath('userData') . You can use this module directly in both the main and renderer process.

Is Electronjs good for desktop apps?

With an improved runtime and great integration with JavaScript and Node. js, Electron JS makes both designing desktop apps and maintaining them on cross platforms easier and better.

What backend does Electron use?

The framework is designed to create desktop applications using web technologies (mainly HTML, CSS, and JavaScript, though other technologies such as frontend frameworks and Web Assembly are possible) which are rendered using a flavor of the Chromium browser engine, and a backend using the Node. js runtime environment.

Does Electron need backend?

As an example architecture, we'll use a desktop app for the Telegram chat web app. Electron will act as a wrapper for the existing web app without requiring any changes to the backend. Setting up Electron is easy for this type of app! There are no changes needed at the web app codebase level.


1 Answers

I would go for PouchDB: https://github.com/pouchdb/pouchdb

PouchDB was created to help web developers build applications that work as well offline as they do online.

NeDB looks also very promising: https://github.com/louischatriot/nedb

Embedded persistent or in memory database for Node.js, nw.js, Electron and browsers, 100% JavaScript, no binary dependency. API is a subset of MongoDB's and it's plenty fast.

like image 143
marcobiedermann Avatar answered Oct 01 '22 23:10

marcobiedermann