Complex app with shared codebase for Electron App and online Web App?


#1

Hi,

is there any app complex app with shared codebase for Electron App and Web App?

All big projects as Atom, Nylas N1 are build only as Electron Desktop Apps and from the forums it seems it is not even possible to use the same codebase to build native Web App that runs online in browser.

Is this even possible to build complex web app e.g. in react/angular/ember and use the same code with some adaptations for both Electron App with offline capabilty and native Web App that runs in online?


#2

You can compare Wordpress Desktop with Calypso. Specifically, Calypso gets included whole inside Wordpress Desktop, while Wordpress Desktop has the specific files needed to do desktop application things like handling processes and errors.


#3

Thanks for the wordpress desktop app example.

If I understand correctly the flow of the app is:

  1. In case of online version of calypso web app
    SPA Web App <---> API Cloud Storage

  2. In case of desktop electron app
    Electron App --> SPA Web App <---> API Cloud Storage

I would like to know if there is existing some real world SPA web app with following flow:

  1. In case of online SPA web app
    SPA Web App <---> API Cloud Storage
  2. List item
    Electron desktop app ---> SPA Web App <--> Electron (NodeJs) sqllite storage

Where the SPA Web App codebase would be the same only Data Access Layer of the app would be different.


#4

I can’t answer that (I skimmed the list of Electron apps and Wordpress is the only one I know has both versions open-sourced), but all you’d really have to do is have duplicate storage and retrieval functions in your web app, where it chooses which functions to use based on how the user is accessing it.


#5

For something like AngularJS the solution seems obvious: put everything that relies on Electron framework into an Angular service and substitute that one with a native Web version (e.g. that talks to a REST API) if needed.

Same approach might also work for other frameworks like React and Ember, but still relies on your experience with properly structuring the code and making sure that “platform-specifics” are factored out from the core of the Web application… (same procedure as when dealing with native Web vs. Mobile Web apps)


#6

Hi, we are facing the same problem now, and We really like the idea you said here:

Web App with NodeJs server as backend and Desktop App with Electron “as backend”.

How is your research going? Any suggestion or thoughts?

Hope you are doing well.
Thank you.