Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Project Structure & | Electron.js Desktop App Development le | BraveProgrammer
  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 24 of 28

·javascript

Project Structure & npm Scripts

8 mins

Course progress86%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • Separate **main**, **renderer**, and **preload** code into distinct folders.
  • Use npm scripts to automate development (`npm run dev`).
  • A `watch‑renderer` script can run a bundler (Vite, Webpack) for hot‑reloading UI.
  • Keep `package.json` clean – expose only what the app needs.

Project Structure & npm Scripts

A common layout:

my-app/
├─ src/            # renderer source (HTML/JS/CSS or a framework)
│   ├─ index.html
│   └─ renderer.js
├─ main/           # main‑process code
│   └─ main.js
├─ preload/        # preload scripts (secure bridge)
│   └─ bridge.js
├─ package.json
└─ .gitignore

Add helpful scripts:

"scripts": {
  "start": "electron .",
  "dev": "concurrently \"npm:watch-main\" \"npm:watch-renderer\"",
  "watch-main": "nodemon --watch main --exec electron .",
  "watch-renderer": "vite --config vite.renderer.config.js",
  "build": "electron-builder"
}

concurrently and nodemon are optional helpers that restart the app on changes.

Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Electron.js Desktop App DevelopmentBrowse activities
Previous lessonYour First Electron App – Hello WorldContinue to lesson 25Creating BrowserWindows – Options & FeaturesBack to Electron.js Desktop App Development curriculum