Advice on correct file structure


#1

I’m an absolute beginner and have just started out with the quick-start example from github.
I’m trying to create an electron app beginning from an already existing web app. As the web app is developed independently from the electron app I thought it might be a good idea to include the existing repository for the web app as git submodule.
My file structure basically looks like this:

├── app
│   ├── main.js
│   ├── renderer.js
│   └── WebappDist
├── dist
├── node_modules
├── package.json
└── Webapp

The webapp is built within the Webapp folder and is then copied into the app folder.

Now what I basically want to know how wrong this is on a scale from 1 to 10 and if there are any things that I can improve.

Thanks for your help :slight_smile:


#2

Electron absolutely doesn’t care what your file structure is. If you use a framework, it might have opinions on where you should put files, but Electron will load whatever it is told to load. This changes a little if you decide to use an ASAR archive.


#3

File organization is good. Good to put together things that go together. If it turns into a negative, I a sure technology exists today that make changing it possible.

I’d say so far, so good. Carry on. Full speed ahead. Forward! Nice looking work.


#4

I feel like it’s most useful to think of Electron like a web server inside a browser. Your package entry point, defined in package.json, is the startup procedure. That almost always involves opening a BrowserWindow and directing it at an HTML file that is a sibling or the child of a sibling to the entry point.