How to: Desktop app should access online data


I basically want to create a desktop app using electron. The app will have basic CRUD operations. However instead of writing the data into local database. I would like to store in online. Just like how a web application can store data in mysql in cpanel and the files in the relative path?.

Since this is a desktop based app. How do i store data online, so that all the clients(using the desktop app) can see the information that i post .

Any kind of help is very much appreciated!


You want to set up an online server (check out Sails.js for a package specifically designed for this purpose) that provides an API, either in the tried-and-true REST form or in the new-and-shiny-and-supported-by-Facebook GraphQL. Then your desktop client will send requests to your server and receive data from it.


@DamnedScholar thanks a lot!!! really appreciate for taking your time to answer mate! I will go through that. have a great day!


you can do the same as web app.
Electron is just desktop app framework, so, you will need to have Web API + DB ( which hosted on server side ).
then, Electron app can make the call to this Web API with regular ‘http(s)’ modules if you are on main process or ‘ajax’ request if you are on HTML (renderer)


THX! @anurocha! I’m familiar with php so I will go by creating api calls and then use electron to call it for posting and getting data. btw i must have a domain in order to be able to do that right? I am thinking do regular desktop app accessing online database/server do/must have a domain so they can request api calls? like without a domain can you use the server location and call apis?


Exactly, You need URL to access the Web API from Desktop app.

Architect will be like this:

[ Your electron app ] == Http/s call with URL == > [ Web REST API ] --> [ Database ]