3

I've been researching for long time but haven't found what I need. Maybe here someone can help me out.

What I want:

I'm trying to create an application that will run inside electron. Both frontend and backend should be encapsulated within a single executable, so I was thinking React js and Nodejs would be a good option.

But it's not as simple as I thought. Found a good boilerplace for reactjs https://github.com/electron-react-boilerplate/electron-react-boilerplate but I have no idea how I could encapsulate nodejs as a backend to it.

It'd also somehow would need to be integrated with the release package and so on... Additionally I'd need to have a webserver that will run on localhost:[port] when you launch the application.

Technical Summary:

So basically:

  • Electron with React js - as the application 'face'
  • Nodejs - as the backend of the application
  • Webserver running locally - (using react js).

In the application, I would put link to the pages that is served by that locally running reactjs web app.

Hope I was clear. And I really hope someone can help me out.

Thanks!!!

2
  • It's a NodeJS app--that there's also Electron isn't terribly relevant. You can do all normal NodeJS things in the non-web-app part of it. Commented Oct 28, 2019 at 12:21
  • Have you find soluition? Commented Feb 9 at 6:38

1 Answer 1

0

as you know the serverside part is separate from front end.you can lunch react electron together like this article https://flaviocopes.com/react-electron/ .but serverside must start to stand alone . you could use pm2 for launching them.http://pm2.keymetrics.io/

lets talk about electron. what is electron? according to electronjs.org :

Electron is an open source library developed by GitHub for building cross-platform desktop applications with HTML, CSS, and JavaScript. Electron accomplishes this by combining Chromium and Node.js into a single runtime and apps can be packaged for Mac, Windows, and Linux.

so the electron is a tool for creating desktop applications.it uses chromium engine for accessing resources of the operating system level. but the intention of that is creating apps not a serverside job. if you have some needs and logics that must handle in a server you should be considering that. otherwise, read about serverless applications.

Sign up to request clarification or add additional context in comments.

10 Comments

pm2 is very nice! But can I also use pm2 to package my applications together into one executable at the end? So when the client starts the executable, pm2 will kick off and start all the relevant services I defined?
you mean every time every user in the world start the application a backend server starts?
no, here everything suppose to run localhost only. There is no webserver hosted in the cloud or anything like that. Everything suppose to be localhost. I was just wondering how this pm2 can help me.
suppose you have a server locates in /home/serverside/ and front end /home/frontend/ . you can feed pm2 config.json for running both server and frontend side . check this link : futurestud.io/tutorials/…
@babakabadkheir It might be good to explain why, since Electron is a NodeJS application, you cannot stand up a server inside of it.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.