New to Electron and trying to build a CRUD app


#1

Hey so I’m new to JS and electron and was wondering how to make an CRUD app.

Does electron natively support everything I will be needing? (setting up a connection to DB, listener, etc)
or should I wrap it all in something like a MEAN stack?


#2

No, Electron is designed to build generic native-style applications. It isn’t designed specifically for CRUD applications, so it doesn’t have any database connectivity built-in. You’ll have to supply that yourself. There are some discussions on the board though about various database options.


#3

Thank you, for letting me know as I was wondering if I was missing something crucial haha.
So to summarize, Electron is not designed to handle database related applications?


#4

It is not optimized for any particular type of application. However it can be used effectively for many sorts of applications; including database backed apps. For example if you wanted sync between local/remote databases then PouchDB is a good option; if you need a relational database then Lovefield might be what you want; for a simple key/value store maybe something like Mozilla’s localForage.

More of the options are described in other database related topics.


#5

Thanks john! I am trying to build an app that would load data from mongo and display it out to the user.
After some thinking I was wondering if it would be wise to use express for the server side and angular to connect the model and the view? In that case from the electron main.js would I simply tell the browser win to open a local host instead of index.html?


#6

There’s not a server-side per se, but since Electron contains Node, you can require the modules, etc, so there’s no need to spin up a server, as your ‘client’ is your ‘server’. (although maybe I’m wrong, I don’t use MongoDB, so I don’t know what it expects, either way there are ways to do it both with and without Express).

Angular is certainly a sensible choice for the controller/view side (with Mongo as your model).


#7

I guess I might have to see examples on this.


#8

Hi, you mentioned Lovefield db for relational db choice. Then I made some research and watched the video introducing the Lovefield. It looks great, but I have some concerns.

The author said there will be only one DB for each domain. I am wondering whether all the windows in Electron App are regarded as In the same domain?

And whether it is possible to access Lovefield in main process?

Thank you very much.


#9

Try this project https://github.com/garrylachman/ElectroCRUD
It does exactly what you are looking for. I think it uses node-mysql.