Database with electron: what to choose?

Hi all,
so the question is what database to use with my electron app if :

  1. my app and database are compeletely offline… no servers or networking
  2. i would like to use graphql to work with the database
    BTW the kind of data is not quite large (no videos or photos,… only textual data) BUT there will be some heavy mathimatical computaions while interacting with different sorts of datat distrbuted at different places
1 Like

Intuitively I thought that mongodb might be one choice … and it seems that graphql and mongodb work together. Another approach would be to use HaXe to create Electron app with backend database.

thank you for the suggestions… i am digiing into that now…
for a frontend developer with zero background in databases… what would be the prerequsites before start working on such project?

1 Like

I would start by learning the differences between SQL (MySQL) and NoSQL (Mongodb) databases. The latter allows json datasets to be managed.

You might start by either installing Mongodb locally or trying it first in the cloud. Here is a very basic tutorial to start.

Given that you have opted for Electron/node.js you can install Node.js driver.

But if you (optionally) opt to develop in HaXe (a higher level language) you can

create HaXe Electron app
use HaXe mongo.db driver
integrate HaXe/React for UI

HaXe desktop

But perhaps that refinement (trying HaXe) should be reserved for a later stage of learning and just start with Electron as frontend and Mongodb as backend.

1 Like

:tada: :tada: :tada: :rocket: :rocket:
thank you so much

Every modern browser has IndexedDB support, so why bother with an extra dependency?

Here’s a simple example that describes querying IndexedDB via GraphQL:

1 Like

this raises the questions:

  1. is the data inside the database is safe when theapplication is shiped an installed on the user’s machine?
  2. what if i want to interact with the data file on the long-term from another dependency?

The problem with this thread is that we are still left guessing the requirements.

Debates about choice of database might be “putting the cart before the horse”.

In first post the OP writes “my app and database are completely offline… no servers or networking”.

But now we learn “is the data inside the database safe when the application is shipped and installed on the user’s machine?”.

These are shifting sands.

Based on this opening requirement

“BTW the kind of data is not quite large (no videos or photos,… only textual data) BUT there will be some heavy mathematical computations while interacting with different sorts of data distributed at different places”

and this last requirement

" i want to interact with the data file on the long-term"

although I still remain in the dark about the real application I would review development plan.

The predominant requirement seems to be “heavy mathematical computations”. Database is less important and could be a simple local user SQLite3 database for all we can deduce so far.

Switch to developing a Shinyapp which can be deployed to users in a number of ways:

This gives the OP central control over the app and ShinyApp is ideal for “heavy mathematical computations”. If the end users are not too technical the ShinyApp could be placed into a UI wrapper (including Electron or Python) to orchestrate the local setup.

1 Like

first of all this is a kick-A$$ discussion… i think a lot of electron beginers will benefit from it just like me.

my inference is that i am okay with any simple database like sqlite3, rxdb, nedb or even mongoDb
as they will all in the end do the job.
may be my big concern was how can i use the powers of graphql (ease of opertaions like query and mutation…etc) with a database in a electron App… nut i guess now i have a myraid of options that are all supposed to be suffice to meet the project requirements

BTW i am literally following this suggestion
its really great for me and puting me on the right track :rocket: :rocket:

Hey, I do not know about how many transactions you will use, I have an application running with sqlite + cypher and it is very good. It is small and fast.

1 Like

i must have some fair amount of transactions TBH :smile:
however, its suffice to say that using mongodb is great for me as a developer for the long run but it seems to be an overkill for simple applications
event hough i am sticking to it and started using monogose for simplicity
speaking of my app:

  1. it shows a lot of reports (gathered data from my databases)
  2. it mostly gonna query information based on creation time
  3. it has no complicated (very very complicated) data processing so will for the most part use simple CRUD ops
  1. LIST ITEM is always what the code is difficult to understand but really wonderful when we understand it just need to focus
1 Like

I am also looking into using electron with a database for a desktop only application (no web access).

Does anyone know of a good tutorial about setting this up? I have used SQL a lot, but I"m open to learning MongoDB if that would work better.


1 Like

in your case, i tried mongodb it can work just fine.
however, you may face some security issues protecting your database. hence, i found that mongodb is best used on sever side apps (this is mostly what it was built for)

Need to understand the nature of your local “database”.
If it is unstructured (largely text) you could interface to a local notebook via command line instead of more formal sql or mongodb.
“database” means different things to some.